Skip to main content
Creating Validation Rules
Updated over 5 months ago

Validation rules are a great way of ensuring all the data entered into fields by your users in records that meet the standards you specify before they can save it.

A validation rule can contain a formula or expression that evaluates the data from 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.

Expected behavior of a validation rule:

  1. The user creates 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.

How to Create a Validation Rule

Validation rules can be broken down into three parts:

  1. Name and Description

  2. The Rule (the Error Condition Formula)

  3. The Error Message

To get started:

Navigate to the Setup (Cog Icon) and click Setup.

Go to the "Object Manager" Tab

Choose the object you would like to add the validation rule to

Scroll down to the "Validation Rules" option on the left hand side

Click New on the Validation Rules page.

Below is an explanation of what each field is and what it is used for:

To see some examples and learn more, check out this article by Salesforce Ben:

For Visual Learners:

Did this answer your question?