CRMSalesforce CRM

Salesforce Validation Rules

By January 26, 2020No Comments

Salesforce provide many ways to customize how your users interact with data, screens, dashboard, etc.  You may have organization wide profile/permissions configured but still have a need to limit functionality.  In this case, validation rules will allow you to set criteria when users perform an action on an object.

Validation Rules allow you to set a true/false condition that will generate a custom error message when a user and/or action is performed that you do not want to be committed to Salesforce.  If the rule evaluates to true, the action will be performed.  If the rule evaluates to false the error will display.  The user can make corrections based on the error message and try the action again.  This is type of validation rule helps keep data consistent.  An example would be placing a validation rule on an Account that does not allow the user to enter values in a Discount field over 30%.  The user would be notified via the error and can change the discount amount and save the record.

For this example we will create another type of validation rule.  This type is based on the user rather than a field value.  When the rule evaluates to true, it will allow one specific user to change the Active field on Account records.  If the rule evaluates to false, the error can display the proper person to notify and make the change.  This way, one person can be notified that an Account is no longer active and be responsible for the proper follow up.

Creating Validation Rules:

  1. Click the Setup icon (Gear) and choose Setup.
  2. Click on Object Manager and select the object you want to add the validation rule to. For this example we are choosing the Account
  3. Choose Validation Rules from the menu on the left.

  1. Click the New button in the top right of the screen.
  2. Give the rule a Name and Description. If you are activating the rule immediately, check the Active  If not, uncheck the box.  You can come back and activate/deactivate rules after they have been created.
  3. Create the true/false condition for the rule. Salesforce provides an example for the Discount percentage not being over 30%.  For this example we will choose the logged in user’s Alias does not equal “BGear”.
  4. Click the Check Syntax button to verify your criterion is correct.

  1. Scroll down the page and enter in the text of the error message you want to display when the rule criteria evaluates to false. You can also choose if the error displays at the top of the page (default) or at the field.  When using rules on field values, it can be more helpful to display the error where the data needs to be checked.

  1. Click the Save
  2. Test the new rule on the organization’s data. Be sure to test for both true and false rule evaluations.  Make changes if needed.
  3. Error Messages will display like this:

Becci MG

Author Becci MG

More posts by Becci MG

Leave a Reply

Questions about Salesforce?

Email Gene directly at!