---
schema_version: "1"
id: abc8bad15c645eff070c5d4d9a28f1ed00c6c5337c98b018aa3a2e3732912f35
title: Examples of Validation Rules
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/fields_useful_field_validation_formulas.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.fields_useful_field_validation_formulas.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 6cefc3e2aae4eb04116d58bdb149e000bd348bac85e4f0c0edae64a1019ed712
description: 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.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Examples of Validation Rules

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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Contact Manager</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, <strong>Developer</strong>, and <strong>Database.com</strong> Editions</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d79120e89">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d79120e89 ">To view field validation rules:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d79120e89 ">View Setup and Configuration</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d79120e89 ">To define or change field validation rules:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d79120e89 ">Customize Application</td>

          </tr>
        </tbody>
      </table>

Use the following samples for validation rules in Salesforce and Salesforce AppExchange apps, including:

- **[Sample Account Address Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_account_address.htm&release=264.0.0&type=5)**  
    Rules to maintain valid account addresses.
- **[Sample Account Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_account.htm&release=264.0.0&type=5)**  
    Validation rule examples for numeric account numbers, account number length, and annual revenue range.
- **[Sample Call Center Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_callcenter.htm&release=264.0.0&type=5)**  
    Validation rules for requiring a conditional description, preventing cases from being reset, restricting case status, and more.
- **[Sample Experience Cloud Site Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_community.htm&release=264.0.0&type=5)**  
    Validation rule examples for various use cases, like preventing offensive language in questions, replies, ideas, and idea comments.
- **[Sample Contact Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_contact.htm&release=264.0.0&type=5)**  
    Validation rules for various use cases, like requiring fields for mailing address, mailing street, and ZIP code.
- **[Sample Cross Object Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_cross_object.htm&release=264.0.0&type=5)**  
    Examples for three validation rules on opportunity products.
- **[Sample Date Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_date.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_number.htm&release=264.0.0&type=5)**  
    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](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_oppty_mgmt.htm&release=264.0.0&type=5)**  
    Examples for Examples for how to validate custom fields and other fields on opportunities.
- **[Sample Quote Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_quote.htm&release=264.0.0&type=5)**  
    An example on how to validate a quote.
- **[Sample User, Role, and Profile Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_userroleprofile.htm&release=264.0.0&type=5)**  
    Examples on how to validate custom user, role, and profile fields.
- **[Miscellaneous Sample Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_other.htm&release=264.0.0&type=5)**  
    Examples for how to validate certain number formats for credit card numbers or drivers licences.

#### See Also

- [Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_about_field_validation.htm&release=264.0.0&type=5 "Improve the quality of your data using validation rules. Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record.")
- [Define Validation Rules](https://help.salesforce.com/s/articleView?id=platform.fields_defining_field_validation_rules.htm&release=264.0.0&type=5 "Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value.")