Validation Rules!

So you need to configure a validation rule, eh? And you’re not sure where to start! You’ve come to the right place! Tho this place is about CPQ, we are still big fans of the platform as a whole!

So let’s create a requirement that would need a validation rule. Let’s make it simple!

Requirement

As the manager of an account rep, I need to make sure the account reps are entering descriptions for certain accounts.

Design

Two new fields on the Account object: Checkbox > Needs Description and Text > Description.

Validation: On an Account record, if the Needs_Description__c checkbox is checked, then the Description__c field must have a value.

Pretty simple. Create the fields. Great. Make sure only the Manager profile can see the Needs_Description__c field! Page Layouts should do the trick.

The first step for the validation rule is to put it into validation rule language: On an Account record, if the Needs_Description__c checkbox is checked and the Description__c field is blank, show a validation error message near the Description__c field that says “You must have a Description for this Account.”

This validation rule language is super important because it tells you how to configure the validation rule.

  • Go to Setup > Object Manager > Account > Validation Rules
  • Click New
  • Name: Needs Desc = Required: Desc
  • Formula: AND(Needs_Description__c = True, ISBLANK(Description__c))
  • Error Message: You must have a Description for this Account.
  • Display: Near field: Description__c
  • Active: Checked

The formula is the tricky part. The formula is written based on the “if” part of the validation language: if the Needs_Description__c checkbox is checked (Needs_Description__c = True) and (AND) the Description__c field is blank (ISBLANK(Description__c)).

Tell us all about your validation rule woes in the comments!

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.