Review examples of validation rules for various types of apps that you can use and modify for your own purposes. Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, Developer, and Database.com Editions |
| User Permissions Needed | |
|---|---|
| To view field validation rules: | View Setup and Configuration |
| To define or change field validation rules: | Customize Application |
Use the following samples for validation rules in Salesforce and Salesforce AppExchange apps, including:
- Sample Account Address Validation Rules
Rules to maintain valid account addresses. - Sample Account Validation Rules
Validation rule examples for numeric account numbers, account number length, and annual revenue range. - Sample Call Center Validation Rules
Validation rules for requiring a conditional description, preventing cases from being reset, restricting case status, and more. - Sample Experience Cloud Site Validation Rules
Validation rule examples for various use cases, like preventing offensive language in questions, replies, ideas, and idea comments. - Sample Contact Validation Rules
Validation rules for various use cases, like requiring fields for mailing address, mailing street, and ZIP code. - Sample Cross Object Validation Rules
Examples for three validation rules on opportunity products. - Sample Date Validation Rules
Examples for date validation rules. For example, how to validate that the value of a custom field is a weekday, a Saturday or Sunday, that a custom date field contains a date within the current month and year, and more. - Sample Number Validation Rules
Examples for how to validate that users can't save a time card record with more than 40 hours in a work week, numbers can't be negative, and even or odd numbers. - Sample Opportunity Management Validation Rules
Examples for Examples for how to validate custom fields and other fields on opportunities. - Sample Quote Validation Rules
An example on how to validate a quote. - Sample User, Role, and Profile Validation Rules
Examples on how to validate custom user, role, and profile fields. - Miscellaneous Sample Validation Rules
Examples for how to validate certain number formats for credit card numbers or drivers licences.