Create Validation Rule in Salesforce

I worked as a Salesforce admin for an organization that uses Salesforce CRM, and our sales team created opportunity records for converted leads.

While creating opportunity records, they had to restrict the close date field so that it would not be less than today’s date. Whenever the sales rep enters the close date today or earlier, an error message should display, and the record should not get saved.

To fulfill that requirement, we have a validation rule in Salesforce. Here, I will explain the validation rules in Salesforce, and then I will show you how to create a validation rule and apply it to different fields in Salesforce.

Validation Rule in Salesforce

In Salesforce, the validation rule requires the user to enter the correct data to save the records. If the user enters invalid input based on certain criteria, an error message will display on the screen.

Using the validation rule successfully gives quality data. The validation rule is evaluated regardless of the medium from which you create the records.

Below are some examples of applying validation rules on fields in Salesforce.

Validation Rule on Text Field in Salesforce

Here, we will take the Text Field example to display an error message when the text field contains a Blank Value or a Numeric Value.

  1. Go to the Gear Icon. -> Click on the Setup. -> Select the Object Manager tab.
Validation rule salesforce
  1. Select the Object on which you want to create the Validation Rule. Here, I’m going to create an Account Object.
Salesforce validation rule
  1. Now select the Validation Rules from the Account object.