Wednesday, December 23, 2015

Validation Rules In Salesforce

Validation rules helps you to improve data quality by preventing users from entering incorrect data. We can write one or more validation rules that consists of an error and corresponding error message.

1. Validation rules are executed will executed, when you are saving the record.
2. A validation rule that contains a formula or an expression that evaluates the data in one or more fields and returns a value, true or false. We can display error message at the top of the page or below the field when rule returns true.
3. After writing validation rules for a field or for set of fields, following actions will fired when user creates a new record or edits an existing records and then click on save button.
Salesforce executes validation rules you defined and if data is valid then record will save.
If entered invalid data, it will display the associated error message without saving the record.
Even if the fields referenced in the validation rules are not visible on the page layouts, the validation rule still apply and will result in an error message if the rule fails.

Creating validation rules:
For standard objects Go to setup -> Build – > Customize -> select standard object you want to create validation rule (For Ex: Account) -> and click on validation rules and then define your validationrule.

For custom objects Go to setup -> Build -> create -> object -> select object you want to create validationrules -> go to validation rules section and then create your validation rule.

No comments:

Post a Comment