Validation Rule in Salesforce helps implement standardization of data captured in the data fields as per the business’s requirement; thereby improving the data input quality of the saved records. This rule is best explained via an example as follows: Business Requirement is to capture the date of birth in the following format DD/MM/YY; however, if the validation rule is not applied then the user can input data in MM/DD/YY or in YY/MM/DD format. With the application of the Validation Rule, the user will receive an error message while trying to save the data in any other format apart from the format required by the business. This rule can be implemented to standardize data for every object present in Salesforce.

What is a Validation Rule made of?

The validation rule consists of the below-mentioned elements:

1. Object: Fields where the data is stored and where the validation rule will perform its field checks to standardize the data as per the business requirement.

2. Formula: A formula is evaluated for the specific business requirement that is to be met. If the formula evaluates to true then an error message is thrown or else it gets saved in the database.

3. Error Message & Error Location: The error message gets displayed on whichever data field does not meet the business requirement.

Following are the steps to implement a rule for a certain object:

Step 1: Go to Setup -Enter Object Manager in a quick box -Select Account (Any Object which you want to make validation).

Step 2: Select the validation rule from the left sidebar.

Step 3: Click on “New”.

Step 4: Enter a name for the rule. 

Step 5: The Error Condition Formula section defines the business criteria to validate the data. To check the formula or expression for error click on Check Syntax.

Step 6: In the Error, message section defines the error message and the position of the error message, which will appear when the user enters the wrong data.

Step 7: Click on “Save”.

Let’s take an Example 

Case: The email field should not be blank in the contact record  as shown below:

Are you looking for a customized Salesforce solution for your business? Please feel free to contact CloudVandana and get the full ROI of your Salesforce investment. 

Request a Free Consultation

YOU MIGHT ALSO LIKE