Sample Opportunity Management Validation Rules
Examples for Examples for how to validate custom fields and other fields on
opportunities.
Available in: both Salesforce Classic and Lightning Experience |
Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, Developer, and Database.com Editions |
For more information on any of the formula functions used in these examples, see Formula Operators and Functions.
Conditionally-Required Field Based on Opportunity Stage
Field | Value |
---|---|
Description: | Validates that a custom field called Delivery Date is provided if an opportunity has advanced to the Closed Won or Negotiation/Review stage. |
Formula: |
|
Error Message: | Delivery Date is required for this stage. |
Error Location: | Delivery Date |
Close Date Cannot Be Prior to Current Month
Field | Value |
---|---|
Description: | Validates that the Close Date of an opportunity is not within a month prior to the current month. Note the use of ISNEW and ISCHANGED in this formula to ensure the condition is only checked when the opportunity is being created or the Close Date field is modified subsequently. |
Formula: |
|
Error Message: | Close Date cannot be prior to current month. |
Error Location: | Close Date |
Close Date Must Be a Future Date
Field | Value |
---|---|
Description: | Ensures that users do not change the Close Date of an opportunity to a day in the past. |
Formula: |
|
Error Message: | Close Date cannot be a day in the past. |
Error Location: | Close Date |
Discounts on Opportunities
Field | Value |
---|---|
Description: | Validates that a custom discount percent field is between 0 and 40%. |
Formula: | OR(Discount_Rate__c < 0, Discount_Rate__c > 0.40) |
Error Message: | The Discount Rate must not exceed 40%. |
Error Location: | Discount Rate |
High-Value Opportunity Must Be Approved Before Closed
Field | Value |
---|---|
Description: | Opportunities with amounts greater than $50,000 require that a custom checkbox field called Approved is checked in order to change the stage to Closed Won or Closed Lost. To automate this, set field-level security on the Approved checkbox so that it can only be checked via a custom approval process (Enterprise Edition, Unlimited Edition, or Performance Edition). |
Formula: |
|
Error Message: | All high-value opportunities must be approved for closure. Click the Request Close button. |
Error Location: | Top of Page |
Opportunity Amount Cannot Exceed $10 Million
Field | Value |
---|---|
Description: | Validates that opportunity Amount is positive and no more than $10 million. This limit is designed to catch typos. |
Formula: |
|
Error Message: | Amount cannot exceed $10 million. |
Error Location: | Amount |
Opportunity Check for Products
Field | Value |
---|---|
Description: | Validates that an opportunity has at least one opportunity product before users can save a change to an opportunity. |
Formula: |
|
Error Message: | You must add products to this opportunity before saving. |
Error Location: | Top of Page |
Opportunity Must Have Products if Beyond “Needs Analysis” Stage
Field | Value |
---|---|
Description: | Validates that an opportunity has opportunity products before the Stage can move beyond Needs Analysis. |
Formula: |
|
Error Message: | Opportunity products are required to advance beyond the Needs Analysis stage. |
Error Location: | Top of Page |
Opportunity Name Format
Field | Value |
---|---|
Description: | Validates that an opportunity contains a hyphen as a way of enforcing an “[Account] - [Amount]” opportunity naming convention. |
Formula: |
|
Error Message: | Opportunity Name should use “[Account] - [Amount]” format. |
Error Location: | Opportunity Name |
Prevent Sales Reps from Moving Opportunity Stage Backwards
Field | Value |
---|---|
Description: | Prevent sales reps from changing opportunity Stage “backwards” to specific values, once they have accepted the opportunity via a custom approval process. The approval process sets the custom Accepted Flag checkbox to True. |
Formula: |
|
Error Message: | Invalid stage for accepted opportunity. |
Error Location: | Stage |
Probability Must Be 100% for Won Opportunities
Field | Value |
---|---|
Description: | Validates that the probability of a won opportunity is properly set to 100%. This is useful for data cleanliness and reporting purposes. |
Formula: |
|
Error Message: | Probability must be 100% for won opportunities. |
Error Location: | Probability |
Probability Must Be Zero for Lost Opportunities
Field | Value |
---|---|
Description: | Validates that the probability of a lost opportunity is properly set to zero. This is useful for data cleanliness and reporting purposes. |
Formula: |
|
Error Message: | Probability must be 0% for lost opportunities. |
Error Location: | Probability |
Project Start Date
Field | Value |
---|---|
Description: | Validates that a field is conditionally required based on the values of other fields. Use this validation formula to ensure that users include a Project Start Date for an opportunity that is closed/won. |
Formula: |
|
Error Message: | Project start date is required for won opportunities. |
Error Location: | Project Start Date |