Validation Rule is some criteria which is defined to validate the data entered by user while creating or manipulating the records. This event fire right after clicking the Save button.
It can contain the formula or expression that validate the data and return ‘true’ or ‘false’. It can also return error message associated with that particular validation rule which will display to user when he enter invalid data.
You can create validation rules for objects, fields, campaign members, or case milestones.
Follow the step to create a validation rule for object.
- Go to Setup ->Enter Object Manager in quick box ->Select Account (Any Object which you want to make validation).
- Select validation rule From left sidebar.
- Click New.
- Enter the Name of the rule.
- In Error Condition Formula section define your criteria to validate the data.
- To check the formula or expression for error click on Check Syntax.
- In Error Message section define your message and position which will appear when user enter wrong data.
- Finally, Save it.
Output Screen:
The above validation is triggered whenever the record is edited.If you want to show the error when creation only, please use below code,
IF( AND(ISBLANK(Phone), ISNEW() ) , True, False)
This information is very useful to create a validation rule.