Essential Validation Rules for Salesforce Admins

In this post, five essential validation rules that Salesforce admins should implement in their clients’ Salesforce orgs are discussed. Improve the quality of your data using validation rules. Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. Before digging into the specific rules this insight will highlight, let’s briefly review what validation rules are.

What are Validation Rules in Salesforce?

Validation rules in Salesforce are used to enforce data quality and consistency by validating the data entered by users before it is saved to the database. These rules consist of expressions or formulas that check the data against specified, required criteria. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value.

After you have defined validation rules:

  1. The user chooses to create a record or edit an existing record.
  2. The user clicks Save.
  3. All validation rules are verified.
    • If all data is valid, the record is saved.
    • If any data is invalid, the associated error message displays without saving the record.
  4. The user makes the necessary changes and clicks Save again.

You can specify the error message to display when a record fails validation and where to display it. For example, your error message can be “The close date must occur after today’s date.” You can choose to display it near a field or at the top of the page. Like all other error messages, validation rule errors display in red text and begin with the word “Error”.

5 Validation Rules Examples

Here are some important validation rules to configure in your Salesforce org:

1. The Account Number Must Be Numeric

To ensure that users enter only numeric values in the Account Number field of the Account object, configure the following validation rule:

plaintextCopy codeOR(
  ISBLANK(AccountNumber),
  NOT(ISNUMBER(AccountNumber))
)

If a text value is entered in the Account Number field, an error message will appear, as shown below:

2. Annual Revenue Range

To restrict accounts with an annual revenue greater than a specific number, use the following rule:

plaintextCopy codeOR(
  AnnualRevenue < 0,
  AnnualRevenue > 1000000
)

If the annual revenue entered exceeds 1 million, an error will be triggered, as illustrated below:

3. Close Date Must Be a Future Date

To prevent sales reps from selecting past dates in the Opportunity Close Date field, implement this validation rule:

plaintextCopy codeCloseDate < TODAY()

Entering a past date in the Opportunity Close Date field will result in the following error:

4. Prevent Open Cases from Being Reset to New

To stop service agents from changing the status of open cases to “New,” configure the following validation rule:

plaintextCopy codeAND(
  ISCHANGED(Status),
  NOT(ISPICKVAL(PRIORVALUE(Status), "New")),
  ISPICKVAL(Status, "New")
)

Attempting to reset the status of open cases to “New” will produce this error message:

5. Blank Email or Mobile

To ensure that at least one communication detail (email or mobile number) is available on a contact record, use this validation rule:

plaintextCopy codeAND(
  ISBLANK(Email),
  ISBLANK(MobilePhone)
)

Leaving both email and mobile fields empty will generate the following error:

Conclusion

These validation rules are essential for maintaining data quality in your Salesforce org. If you have additional validation rules in mind, please share them in the comments below so everyone can benefit.

  • Managing Validation Rules
    Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value.
  • Define Validation Rules
    Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value.
  • Clone Validation Rules
    Create new validation rules quickly by using existing rules as your starting point.
  • Activate Validation Rules
    How to activate and deactivate validation rules.
  • Validation Rules Fields
    A list of fields and description for validation rules.
  • Tips for Writing Validation Rules
    Keep these tips in mind when writing validation rules.
  • Validation Rule Considerations
    Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value. Review these considerations before implementing validation rules in your organization.
Related Posts
Salesforce Jigsaw
Salesforce Jigsaw

Salesforce.com, a prominent figure in cloud computing, has finalized a deal to acquire Jigsaw, a wiki-style business contact database, for Read more

Top Ten Reasons Why Tectonic Loves the Cloud
Cloud Managed Services

The Cloud is Good for Everyone - Why Tectonic loves the cloud  You don’t need to worry about tracking licenses. Read more

What is a Salesforce Jumpstart?
Salesforce Quickstart

A Salesforce Jumpstart is a program designed to help businesses quickly and efficiently implement Salesforce, which is a powerful customer Read more

50 Advantages of Salesforce Sales Cloud
Salesforce Sales Cloud

According to the Salesforce 2017 State of Service report, 85% of executives with service oversight identify customer service as a Read more