What is a validation rule?
A validation rule will conditionally prevent records from being saved.
Why use validation rules?
Use validation rules to ensure that users enter valid data when creating or updating records.
Note, “Reason Lost” is NOT required when the opportunity stage is any other value. Therefore, making “Reason Lost” required on the page layout would not be appropriate. The key benefit of validation rules is that they conditionally prevent records from being saved.
For more examples:
Examples of Validation Rules
[Should / Long / Salesforce.com]
Creating validation rules
Validation rules can be created on most standard and custom objects, and use the same syntax as formulas.
- Validation rules will impact API usage, web-to-lead, and web-to-case submissions. Make sure to structure your validation rules so that they will not unintentionally interfere with these operations (such as rejecting a web-to-lead submission). It is possible to either add exceptions for users/profiles in the validation rule, or use custom settings in conjunction with validation rules (this second solution is likely more complex than what would be presented on the ADM201 exam). In some scenarios, you may need to disable validation rules when importing or updating data, and reinstate them afterwards.
- Too many validation rules can be frustrating from a user interface perspective, as the error is not presented until after the user attempts to save the record. Make fields required when possible (as they are indicated as required in the user interface), and employ other usability features as appropriate (for instance, create a page layout section for information required when an opportunity is lost if more than 1 field is captured).
- Some formula arguments (such as VLOOKUP) can only be used in validation rules.