In this we will learn about Validation Rule with an example.It 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.
Steps:
Follow the step to create a validation rule for object.
- Goto SetUp>>Customize>>Account(Any Object).
- From left sidebar click validation rule.
- 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.
Example:
Now we are going to write validation rule for contact object which fires when contact is save. This rule validate whether contact’s age is more than 18 years or not. This will through error when contact’s age is less than 18.
- Goto SetUp>>Customize>>Contact.
- From left sidebar click validation rule.
- Click New.
- Enter the Name of the rule i.e. Verify_Age
- In Error Condition Formula section define your criteria to validate the data. i.e Year( Birthdate) > 1999
- 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. i.e. Contact must be more than or equal to 18 years
- Finally, Save it.
Support
That’s all for Validation Rule, still if you have any further query feel free to contact us, we will be happy to help you https://wedgecommerce.com/contact-us/.