Validation Rules in Salesforce:
|Salesforce validation rules allow you to specify certain conditions that must be met before a record can be saved in Salesforce. These rules help to ensure that the data entered into Salesforce is accurate, consistent, and complete.|
(1) In this blog we will learn how to use validation rules in the salesforce. In this example, we have applied the validation rule on the Entry Date field as shown below. Validation: The entry Date should be mandatory and always be today’s date.
(2) Go to the Salesforce setup page and click on the Object Manager as shown below.
(3) Now Object Manager Set Up page is opened. In the Quick Find box, search for the Custom Object (Earthquake Death Count) that we have created in the previous blog and click on it as shown below. Learn here: How to Create Custom Objects in Salesforce.
(4) Our Custom Object (Earthquake Death Count) page is opened. On the left side click on Validation Rules as shown below.
(5) Now our Validation Rules page is opened. You have to click on the New button to create validation rules as shown below.
(6) Our validation rule creation page is opened. Now there are three important things here- the first thing is the error condition formula i.e. you need to define what should be the criteria for which the error should occur. The next is the error message i.e. what message do you want to show to the user when the error occurs or this formula evaluates to true? The last thing is the location of the error whether it should be on the top of the page or it should be on the field so here you can define what field you want the error to be shown.
(7) Validation Rule is created as shown below.
Check the Validation Rule:
(1) Go to the app launcher and search for Earthquake Tracker App and click on it as shown below.
(2) Earthquake Tracker App is opened. In the Earthquake Death Counts tab, from the drop-down click on New Earthquake Death Count or click on the Earthquake Death Counts tab and press the New Button as shown below.
(3) New Earthquake Death Count pop-up opens. In the Entry Date field, if you select a date other than the present date and hit the save button then it throws an error as shown below.
If you select the present date and hit the save button then your record will be created. In this way, the validation rule works in Salesforce. You can apply the validation rules on any field depending on your requirement.
Dynamics 365 Business Central Functional Tutorial– ERP Consultors