0% found this document useful (0 votes)
64 views22 pages

Validation Rule Exasmples

The document discusses validation rules in Salesforce, providing guidance on when to use them, how to create them, and examples. Validation rules verify that user-entered data meets criteria before being saved. They are created by admins and include a name, description, and error condition formula to specify validation logic. The document then provides a sample validation rule to require selecting a closed lost reason for opportunities changed to that stage.

Uploaded by

nehadupate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views22 pages

Validation Rule Exasmples

The document discusses validation rules in Salesforce, providing guidance on when to use them, how to create them, and examples. Validation rules verify that user-entered data meets criteria before being saved. They are created by admins and include a name, description, and error condition formula to specify validation logic. The document then provides a sample validation rule to require selecting a closed lost reason for opportunities changed to that stage.

Uploaded by

nehadupate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

 JOB BOARD

(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

Written By...

Lucy Mazalon
(https://www.salesforceben.com/author/lucy-
mazalon/)
Lucy heads up Operations at Salesforceben.com (https://www.salesforceben.com/),
Founder of THE DRIP and Salesforce Marketing Champion 2020.
 (//TWITTER.COM/LUCYMAZALON) 
(//WWW.LINKEDIN.COM/IN/LUCYMAZALON/)

Share this article...

(https://www.facebook.com/sharer/sharer.php?
Posted on November 16, 2021 in Admins
(http://twitter.com/intent/tweet?
(http://www.linkedin.com/shareArticle?
(http://reddit.com/submit?
u=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fwww.salesforceben.com%2Fvalidation-
text=How%20to%20Use%20Validation%20Rules%20in%20S
(https://www.salesforceben.com/category/guides/admins/)
mini=true&url=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fwww.salesforceb
url=https%3A%2F%2Ffanyv88.com%3A443%2Fhttps%2Fwww.salesforceben.
How to Use Validation rules- rules- Rules in Salesforce
rules- rules- (+
Examples)
in- in- in- in-
Validation Rules (https://help.salesforce.com/articleView?
salesforce%2F) salesforce%2F)
id=fields_about_field_validation.htm&type=5) salesforce%2F&title=How%20to%20Use%20Validat
in Salesforce salesforce%2F&title=How%20to%20Use%2
verify that the data entered by a
user meets certain criteria before the user can save the record. Salesforce Admins set up the Privacy - Terms
rules as statements, which act like yes/no questions – the answer must be no to all of them. If
not, an error message appears, where the admin has explained what the user must doJOB to BOARD
correct/www.salesforceben.com)
the record, before clicking “Save” again. (HTTPS://JOBS.SALESFORCEBEN.COM/)
(https:/
COURSES
START HERE 
If you’re feeling a little lost, don’t worry. This guide will help you learn when to use validation
(HTTPS://COURSES.SALESFORCEBEN.COM/)
rules and how to create them, as well as providing 14 examples for Sales and Service Cloud.
(https://courses.salesforceben.com/wp-
BLOG 
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
(https://www.copado.com/salesforce-testing/?utm_source=sf-
A-SALESFORCE-JOB/)
ben&utm_medium=display&utm_campaign=sf-ben-fy23-q1&utm_term=10x-
faster&utm_content=side-box)
ABOUT 

When Should I Use Validation Rules?


Use validation rules to maintain user input data or system modified records.

➤ User input data: Where users may be prone to making mistakes or cutting corners, or
when you need data to be in a certain format.

➤ System modified records: Changes to data triggered by imports, automated


processes, integrated systems, etc. will need to abide by validation rules*.

*Having said that, validation rules are a safety net that these processes, ideally, should not
bump up against. Admins should prepare/design automation/integrate systems respecting
active validation rules. As we will see later, you can also write validation rules to bypass system
modified records.

The most famous example is “Closed Lost Reason” on Opportunities. Imagine that you want to
track why potential sales fell through. Your sales reps change the Opportunity Stage to “Closed
Lost” but forget to select a reason – stop right there! The rep is prompted to fill in the field and
then saves the record successfully.

Privacy - Terms
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

A validation rule saves the day by preventing reps from closing an Opportunity while the “Closed
Lost Reason” field is blank.

Validation Rules vs. Required Fields


Why not simply make the field required? Required fields are ‘all or nothing’; you must complete
the field for the record to be created. Validation rules kick in only under certain conditions.

In the Closed Lost Reason example above, we don’t require that field to be completed until the
Opportunity Stage is being changed to “Closed Lost”. It wouldn’t make sense for the ‘Closed Lost
Reason’ field to be required at any other stage of the pipeline. The ‘Stage’ value is the condition.

How to Create a Validation Rule in


Salesforce
Validation rules can be broken down into three parts:

1. Name and Description

2. The Rule (the Error Condition Formula)

3. The Error Message

Let’s see how the ‘Closed Lost Reason’ validation rule example looks from an admin’s
perspective. Privacy - Terms
1. Name and Description JOB BOARD

A name and description is very important – a small(HTTPS://JOBS.SALESFORCEBEN.COM/)
clear/www.salesforceben.com)
(https:/ part of your org do
(https://salesforceben.com/complete-guide-to-salesforce-documentation/)c COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)
(https://salesforceben.com/complete-guide-to-salesforce-documentation/)umentation
(https://salesforceben.com/complete-guide-to-salesforce-documentation/)
BLOG 
that will benefit
(https://courses.salesforceben.com/wp-
others who want to understand the purpose of the rule, and/or to modify it in the future.login.php)
GET CERTIFIED!
Keep it short and simple! You may find that the description could be the same as the error
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
message (step #3), but also add any context about who the rule was requested by, or what data
SALESFORCE-CERTIFIED/)
issues the rule is preventing.
GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

2. The Rule (the Error Condition Formula)


Setting up the validation rule itself is the trickiest part of this process to grasp. Even though I’ve
worked with the Salesforce platform for years, I still need to refer back to validation rule
reference guides (hopefully you, too, will bookmark this page!).

“Error Condition Formula” is the fancy name for the rule. Here is where you will tell Salesforce
“if this happens | then that must be true“, for example:

“If the Opportunity ‘Stage’ is ‘Closed Lost’ | then the ‘Closed Lost Reason’ field must not be blank”

I will give you a tour around each of the buttons above the formula box. Then you’ll be able to
practice Validation Rules using the 14+ examples that follow.

Insert Field
This opens a pop-up that lists fields in the object you are writing the validation rule for.

Tip: Use this button! Sure, it does save time, but also many validation rule errors are caused by
field names being slightly different than you may have guessed.

Remember, what you see on the record is the “Field Label”; Validation Rules and other formulas
use the “Field API Name“.

In fact, Opportunity Stage is a perfect example. The API Name is “StageName”, not Stage:

Privacy - Terms
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

Once you have located your field, use the “Insert” button
ABOUT  to drop it into the formula.

Insert Operator
This opens a dropdown menu that lists operators, such as + (add), <> (not equal), etc.

You will be familiar with most because they follow standard mathematics syntax.

The key ones you need to know, which will stitch your formula statements together, are:

➤ && (and)

➤ || (or)

Insert Selected Function


Privacy - Terms
This menu lists functions that you may be unfamiliar with.
 JOB BOARD
There are different types of functions (view a full glossary here)
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
(https://help.salesforce.com/articleView?id=customize_functions.htm&type=5). Luckily,COURSES
by
START HERE 
selecting one, a description appears below the list. (HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG functions are:


The most commonly used  (https://courses.salesforceben.com/wp-
login.php)
➤ ISBLANK(field) returns “True” if the field is blank.
GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
➤ ISPICKVAL(field, specific picklist value) returns “True” if a picklist value in a field
SALESFORCE-CERTIFIED/)
matches the picklist value in the formula.

➤ GET AaJOB
TEXT() converts picklist value to text, a quirk for writing formulas that ask if a
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
picklist field is blank/not blank.
A-SALESFORCE-JOB/)
➤ AND() returns “True” if all the items or functions are “True”.
ABOUT 
➤ OR() returns “True” if any of the items or functions are “True”.

When to use && and ||, or AND() and OR()? We’ll come back to this later!

Check Syntax
This checks if the rule has been written correctly. Salesforce will even tell you what the problem
is.

The most common issues are you:

➤ Are missing a parenthesis “)” somewhere.

➤ Misspelled a field name.


Privacy - Terms
➤ Used the wrong function.
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
3. The
(https:/ Error Message
/www.salesforceben.com)
COURSES
START HERE 
This error message will appear when a user does not meet the requirements set out by the
(HTTPS://COURSES.SALESFORCEBEN.COM/)
validation rule. This is how the admin explains what the user(https:/
must /courses.salesforceben.com/wp-
do to correct the record,
BLOG 
before clicking “Save” again. login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

The error message location can appear at the top of the page or above the specific field causing
the failed save. If there’s only one field the rule references, I recommend you locate the error
message on the field (otherwise, locate it at the top of the page).

Finally, activate your rule by checking the “Active” checkbox!

Sales Cloud Validation Rules


Sales reps aren’t the greatest fans of data input. To keep your Salesforce data quality on track,
use validation rules to guide users while working with Sales Cloud objects.

Which information can sales reps realistically complete themselves based on customer
conversations? Enforcing fields such as “Annual Revenue” isn’t the best idea, seeing as a) users
won’t want to search for that information online, and b) you can leverage data enrichment tools
for more accurate data.

Stick to what sales reps should be asking during conversations, or what can be determined by
using common sense (e.g. the “State” field can only be “Alabama” if the country is “United
States”).

Here are examples for Accounts & Contacts, Leads, Opportunities, Contracts, and Orders.

Information Required by Account Type


Accounts & Contacts

Take basic Account validation rules further by creating multiple validation rules based on a
specific field.

Example: You require different information depending on what the ‘Account Type’ field value is. Privacy - Terms
If they are a ‘prospect’, we need less information filled in than if they are a ‘customer’. For
a prospect.
customers, we need a full billing address, but not yet if they are JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
As each line of the address is a separate field, we need to use OR() to catch the record ifCOURSES
any of
START HERE 
the address fields are missing: (HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
1 AND( login.php)
2 OR(ISBLANK(BillingStreet),ISBLANK(BillingCountry),ISBLANK(BillingCity),ISBLA
3 (Text(Type) GET
= "Customer"))
CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)
While this is a quick fix, it’s not the most helpful for your users. Alternatively, look into one of the
GET A JOB
options in the next section.
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
Example: you requireA-SALESFORCE-JOB/)
different information depending on the Account Record Type. You may use
Record Types to separate customer and partner accounts.
ABOUT 
Use the Validation Rule above, switching:

1 (Text(Type) = "Customer")
2 To: (RecordTypeId) = [INSERT ID])

Country Validation Rules


Accounts & Contacts

Validation on the “Billing Country” field is one of the most important validation rules you can
implement on the Account.

If you let employees enter a country name as free text, different formats and spelling mistakes
will become an admin headache.

Take the United States of America – you will find people could switch between the USA, U.S.A,
US, and United States.

There are a few ways to solve this problem.

1. Salesforce Autocomplete Address Fields


(https://www.salesforceben.com/autocomplete-address-fields-in-salesforce-to-
supercharge-productivity/): a Salesforce feature where suggested matching results
appear when a user begins typing an address.

2. AddressTools: this AppExchange app instantly solves the problem, too, however
there’s much more to this tool beyond the Salesforce functionality, so I recommend
you check out our full review.

Required Fields for Lead Conversion


Lead

Lead records usually have minimal information because this is the start of a Business
Development rep’s (BDR) relationship with them. As qualification progresses, a BDR will get to
know more about them.
Privacy - Terms
Once a prospect is qualified (the BDR is satisfied they have an interest in purchasing your
product/service), the record is converted.  JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
Example: You require contact information (phone number, email) to ensure the qualifiedCOURSES lead
START HERE 
can be contactable. You also want BDRs to pass on a(HTTPS://COURSES.SALESFORCEBEN.COM/)
“Rating” to the next rep that will be
handling the opportunity stages. (https://courses.salesforceben.com/wp-
BLOG 
login.php)
1 IsConverted
2 && GET CERTIFIED!
3 OR( (HTTPS://WWW.SALESFORCEBEN.COM/GET-
4 SALESFORCE-CERTIFIED/)
ISBLANK (Phone),
5 ISBLANK (Email),
6 ISPICKVAL (Rating, “”)
GET A JOB
7 )
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)
Accounts created only through Lead Conversion
ABOUT 
Example: You would like all records to go through the lead stages to ensure they have been
properly qualified. Therefore, reps shouldn’t be creating accounts directly, skipping the lead
lifecycle, as a result.

If you block users from creating Accounts, they won’t be able to convert Leads either – that’s
why you need a Validation Rule!

Step 1: Create a lead formula field

A field that captures the lead created date means that the record must have existed as a lead in
the first place. Create a lead formula field that adds the value of the standard ‘Lead created
date’ field.

Create a date field on the Account object.

Then, map the Lead formula field to the Account date field.

Step 2: Create the Account Validation Rule:

1 ISBLANK ( LeadCreatedDate__c )

Bonus: this validation will carry over the Lead’s created date to the Opportunity, meaning that
you can calculate the total time it takes – from first interaction to won business – for the first
deal with them.

Required Fields for Closed Won Opportunities


Remember the validation rule that asks for information before a Lead can be converted?

Privacy - Terms
Change ‘IsConverted’ to ‘IsWon’ and use the same Validation Rule to ensure the fields required
JOB BOARD
the sales team to a post-
to close an Opportunity are filled, helpful for handing over from
sales/onboarding team. (HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
Limit to one open Opportunity at a(HTTPS://COURSES.SALESFORCEBEN.COM/)
time
BLOG  (https://courses.salesforceben.com/wp-
One Account can have multiple Opportunities associated (one-to-many relationship).
login.php)

Example: You would GETlike each Opportunity to be closed (won/lost) before a new Opportunity is
CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
created, so that the Account is only engaged in one sales process at a time.
SALESFORCE-CERTIFIED/)
Step 1: Create an Account roll-up summary field
GET A JOB
To count the number(HTTPS://WWW.SALESFORCEBEN.COM/GET-
of open Opportunities:
A-SALESFORCE-JOB/)

ABOUT 

Step 2: Create the Opportunity Validation Rule:

1 Account.NumberofOpenOpportunities__c > 1

Won Opportunities must have an Amount greater than 0


The “Amount” field is populated either by products being added to the Opportunity, or users
manually entering the number.

Example: You want to avoid blank or $0 values in the closed business reporting.

1 OR( ISBLANK(Amount), Amount <= 0 )

Contract End Date must be after the Contract Start Date


Use this Validation Rule on Contracts (or any other object, like Campaigns) where two date fields
represent a duration, and can be edited by users.

Example: The End Date must be after the Start Date.

1 StartDate > EndDate

Order Products cannot be modified for “Activated” Orders


Privacy - Terms
Example: Once an Order has been placed (Activated), you don’t want its related Products to be
JOB BOARD
 from what your reports
modified. Otherwise, what’s delivered or billed for will be different
reflect./www.salesforceben.com) (HTTPS://JOBS.SALESFORCEBEN.COM/)
(https:/
COURSES
START HERE 
1 ISPICKVAL (Order.Status, “Activated”) (HTTPS://COURSES.SALESFORCEBEN.COM/)
BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
Service Cloud Validation Rules
SALESFORCE-CERTIFIED/)

GET A JOB
Service agents have (HTTPS://WWW.SALESFORCEBEN.COM/GET-
enough to juggle while assisting customers on the phone, email, chat, or
the many other channels they are expected to monitor.
A-SALESFORCE-JOB/)

Which information should an agent complete that keeps a solid audit trail of the customer’s
ABOUT 
issue, and the service they delivered? This information capture should be purposeful to provide
feedback to other parts of the organization, such as product development, sales, or marketing.
Also, validation early on in the case management process can benefit reps later in the process
by narrowing down or automating processes, so look out for those opportunities.

Cases cannot be edited when owned by a Queue


Salesforce Queues (https://www.salesforceben.com/everything-you-need-to-know-about-
salesforce-queues/) prioritize, distribute, and assign records for teams who share workloads.
This is ideal for support teams who can pick up Cases from the Queue when they have the
capacity, reducing the time a customer has to wait.

Example: Once an agent picks up a Case, they should assign it to themselves (and change the
Case Owner field). This means that Case activity won’t be associated with that user – both the
good and the bad!

1 LEFT (OwnerId,3) <> “005”

This simple validation rule will prevent a user from editing the Case when it’s owned by a Queue.
What’s it mean? All user record IDs start with 005!

Bonus: Use this validation for Lead Queues too!

Case Origin cannot be edited


Example: You want to prevent users from changing the “Case Origin” field after the Case has
been created.

1 ISCHANGED (Origin)
2 &&
3 NOT( ISNEW() )

If Case Status is not ‘New’, the Contact cannot be blank


Example: You want the agent to fill in the customer contact that has raised the support request
(linking it to the respective Contact record).
Privacy - Terms
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

1 NOT (ISPICKVAL (Status, ’New’))


ABOUT 
2 &&
3 ISBLANK (ContactId)

Required fields to close a Case


Example: When agents wrap up Cases, you want certain fields to be completed for reporting
reasons.

The rule below will require the user to input the reason, type, subject, and description.

1 IsClosed
2 &&
3 OR(
4 ISPICKVAL (Reason, “”),
5 ISPICKVAL (Type, “”),
6 ISBLANK (Subject),
7 ISBLANK (Description)
8 )

‘IsClosed’ is a checkbox field that groups different closed statuses together (regardless of
whether the outcome was successful/unsuccessful). Like we saw in the first “Closed Lost
Reason” example, you can request information at different stages during the Case management
process by using the “Status” field:

1 OR(
2 ISPICKVAL (Status, ‘Working’)
3 &&
4 OR(
5 ISPICKVAL (Reason, “”),
6 ISPICKVAL (Type, “”)
7 ),
8 IsClosed
9 &&
10 OR(
11 ISBLANK (Subject),
12 ISBLANK (Description)
13 )
14 )

Closed Cases cannot be modified Privacy - Terms


Example: Once a Case has been closed, it should not be updated or reopened.
 JOB BOARD
The rule is breathtakingly simple: (HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
IsClosed START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)
Tip: You can link Cases through the “Parent Case” field.If a support
BLOG issue needs to be reopened,
(https://courses.salesforceben.com/wp-
users can create a new Case and link the new case to the previously Case. login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

Top Tips for Working with Salesforce


Validation Rules
Validation Rules that Bypass System Modified Records
Ideally, admins should prepare/design automation/integrate systems respecting active
validation rules. However, having a way to toggle which users should bypass validation rules is
very useful.

Step 1: Create a checkbox field on the User object.

You can call it “bypassVR__c”, “overpassVR__c”, or something more meaningful to you.

Step 2: Edit User records.

Check the checkbox field for all users who should avoid the validation rules.

Step 3: Add the condition to validation rules.

Enter the following into every validation rule you create in your org:

&& NOT(OverpassVR__c)
Privacy - Terms
Note: You can also use “User Profile” in validation rules to apply this to a group of users who
share the same profile.  JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
&& and ||, or AND() and OR()
START HERE 
COURSES
(HTTPS://COURSES.SALESFORCEBEN.COM/)
As promised, I’m now going to answer this burning question. Here is the same formula, written
BLOG  (https://courses.salesforceben.com/wp-
in different ways:
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

Which should you use? Answer: it’s mostly up to personal preference. However, if your rule
contains multiple statements, you should use AND() and OR() because indenting and using
separate lines will help identify syntax issues.

Privacy - Terms
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
SummarySTART HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)
COURSES

BLOG  (https://courses.salesforceben.com/wp-
This guide has covered when to use validation rules and how to create them, as well as
login.php)
examples that are ready for you to implement in your org.
GET CERTIFIED!
Hopefully you have a(HTTPS://WWW.SALESFORCEBEN.COM/GET-
solid understanding of how to modify these validation rules to your own
requirements in yourSALESFORCE-CERTIFIED/)
org, including any custom fields you may have.

The examples in this GET


guide have mostly focused on required information. Next you should
A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
explore the ways validation rules can be used with calculations, or used for data formatting.
A-SALESFORCE-JOB/)

ABOUT 

(https://gearset.com/blog/deploy-salesforce-metadata-faster-than-ever-with-live-
comparisons/?
utm_source=salesforce_ben&utm_medium=referral&utm_campaign=live_comparison&utm_content=top_live_comparison)

YOU MIGHT ALSO LIKE...

How to Connect Salesforce to Google Ads

Privacy - Terms
Written By Romain Blanc (https://www.salesforceben.com/how-to-connect-salesforce-to-
 JOB BOARD
google-ads/) (HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

Ultimate Guide to Salesforce Dynamic Related Lists


Written By Christine Marshall (https://www.salesforceben.com/ultimate-guide-to-

salesforce-dynamic-related-lists/)

30 Salesforce Admin Interview Questions & Answers


Written By Michael A. Grandel (https://www.salesforceben.com/30-salesforce-admin-

interview-questions/)

Privacy - Terms
Previous Post: Enable Salesforce Path In 6 Easy Steps
(https://www.salesforceben.com/implement-salesforce-path/)  JOB BOARD

Next Post: (HTTPS://JOBS.SALESFORCEBEN.COM/)


3 Ways Pardot Protects Your Email Reports from Non-human Activity
(https://www.salesforceben.com)
COURSES
(https://www.salesforceben.com/the-drip/pardot-protects-your-email-reports-from-non-
START HERE 
human-activity/) (HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)
5 thoughts GET
onCERTIFIED!
“How to Use Validation Rules in
Salesforce (HTTPS://WWW.SALESFORCEBEN.COM/GET-
(+ Examples)”
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
Mathew Abraham
A-SALESFORCE-JOB/) Reply
November 10, 2021 at 5:30 pm (https://www.salesforceben.com/validation-rules-in-salesforce/#comment-
94693)
ABOUT 
Thanks for this. However the below statement is incorrect:
“Salesforce Admins set up the rules as statements that must be ‘true’ for the
record to be saved – in other words, the rule consists of ‘yes/no’ questions,
and the answer must be ‘yes’ to all of them.”
As far as I understand, it’s just the opposite! Meaning, if the formula is ‘True’
the validation throws the error, and not the other way around. Please correct
me if I am wrong! Thanks

Lucy Mazalon Reply


November 15, 2021 at 10:18 am (https://www.salesforceben.com/validation-rules-in-
salesforce/#comment-95042)

You’re totally right, thanks for pointing that out Mathew.

Dee (http://employedforgood.com) Reply


November 17, 2021 at 12:12 pm (https://www.salesforceben.com/validation-rules-in-salesforce/#comment-
95115)

I can’t think of an automation that comes to mind but I LOVE this idea and can
already visualize the impressive looking dashboards this can yield. Thanks for
the food for thought!

Varun Reply
May 26, 2022 at 7:28 am (https://www.salesforceben.com/validation-rules-in-salesforce/#comment-
111687)

Each Account can only have 1 Open Opportunity at a time. There can be as
many Closed Opportunities as needed, but only 1 Open Opportunity. Can anyone
tell me how to do that.
Thanks in Advance

Christine Marshall (https://theeverydayadmin.com/) Reply


Privacy - Terms
May 31, 2022 at 10:13 am (https://www.salesforceben.com/validation-rules-in-
salesforce/#comment-112349)
 JOB BOARD
Hi Varun, (HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
I would created a roll-up summary COURSES
field on the Account object that
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)
shows the number of open Opportunities (you’ll need to add a filer to
your roll-up to only show openOpps).
BLOG Then/courses.salesforceben.com/wp-
(https:/ you can reference this
new field on the Opportunity object. login.php)
Your rule will be something like:
GET CERTIFIED!
Number_Of_Open_Opps__c >= 1
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
You’ll need to add the correct field name. This rule will simply check
SALESFORCE-CERTIFIED/)
if the number of open opps is equal to or greater than 1.
GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ADD COMMENT
ABOUT 

Name (required)

Email (required)

Website (optional)

Submit Comment

 (https://www.facebook.com/salesforceben)
FOLLOW  (https://www.twitter.com/salesforceben)
US
 (https://www.instagram.com/salesforceben/)
 (https://www.linkedin.com/company/salesforce-ben)

Privacy - Terms
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(https://info.eggplantsoftware.com/a-
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
strategic-guide-to-salesforce-testing?
A-SALESFORCE-JOB/)
cmpid=ASC-
2104789&utm_campaign=FY22%20CRM%20Campaign&utm_source=salesforceben&utm_medium=banner-
ABOUT 
a&utm_term=testing-at-lightning-
speed&utm_content=strategic-guide-
to-salesforce-testing)

(https://go.codescan.io/CS_Report_SF_BEN_Banner)

POPULAR POSTS

1. (https://www.salesforceben.com/how-much-are-salesforce-employees-paid/)
How Much Are Salesforce Employees Paid in 2022?
(https://www.salesforceben.com/how-much-are-salesforce-
employees-paid/)

2. (https://www.salesforceben.com/ultimate-guide-to-salesforce-dynamic-related-
lists/)
Ultimate Guide to Salesforce Dynamic Related Lists
(https://www.salesforceben.com/ultimate-guide-to-salesforce-
dynamic-related-lists/)
Privacy - Terms
(https://www.salesforceben.com/30-salesforce-admin-interview-questions/)
3. JOB BOARD
30 Salesforce Admin Interview Questions & Answers
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
(https://www.salesforceben.com/30-salesforce-admin-interview- COURSES
START HERE 
questions/) (HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)
4. (https://www.salesforceben.com/salesforce-unveil-business-analyst-certification/)
SalesforceGET CERTIFIED!
Unveil Business Analyst Certification
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
(https://www.salesforceben.com/salesforce-unveil-business-
SALESFORCE-CERTIFIED/)
analyst-certification/)
GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)
5. (https://www.salesforceben.com/introducing-sales-cloud-unlimited-the-new-
salesforce-unlimited-edition/)
ABOUT 
Introducing Sales Cloud Unlimited - The New Salesforce Unlimited
Edition (https://www.salesforceben.com/introducing-sales-cloud-
unlimited-the-new-salesforce-unlimited-edition/)

Privacy - Terms
 JOB BOARD
(HTTPS://JOBS.SALESFORCEBEN.COM/)
(https://www.salesforceben.com)
COURSES
START HERE 
(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

GET CERTIFIED!
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)

GET A JOB
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
A-SALESFORCE-JOB/)

ABOUT 

(https://jobs.salesforceben.com/)

(https://gearset.zoom.us/webinar/register/3416535731414/WN_0wbTGhUtT8-
ysZPHrOi-Zg)

SUBSCRIBE TO OUR NEWSLETTER

Type your email

SUBSCRIBE

Privacy - Terms
CONNECT WITH US  JOB BOARD

 (https://www.facebook.com/salesforceben)  (https:/
(https://www.twitter.com/salesforceben)
/www.salesforceben.com)  (https://www.instagram.com/salesforceben/)
(HTTPS://JOBS.SALESFORCEBEN.COM/)
COURSES
START HERE
 (https://www.linkedin.com/company/salesforce-ben)

(HTTPS://COURSES.SALESFORCEBEN.COM/)

BLOG  (https://courses.salesforceben.com/wp-
login.php)

Address GET CERTIFIED!


(HTTPS://WWW.SALESFORCEBEN.COM/GET-
SALESFORCE-CERTIFIED/)
Salesforce Ben
Third Floor Library Building
GET A JOB
Sun Street
(HTTPS://WWW.SALESFORCEBEN.COM/GET-
Tewkesbury A-SALESFORCE-JOB/)
Gloucestershire
United Kingdom ABOUT 
GL20 5NX

Interested in guest posting?


(/guest-poster-request-form/)Have something to share? Want to tell your story? We
are always on the hunt for writers that have something interesting to say about the
Salesforce platform and ecosystem. Join our group of 400+ trusted guest posters – Click here
to start the conversation (/guest-poster-request-form/).

Legal Stuff
Privacy Policy (https://www.salesforceben.com/privacy-policy/)

Recent Posts
How to Connect Salesforce to Google Ads (https://www.salesforceben.com/how-to-connect-
salesforce-to-google-ads/)

Ultimate Guide to Salesforce Dynamic Related Lists (https://www.salesforceben.com/ultimate-


guide-to-salesforce-dynamic-related-lists/)

How Much Are Salesforce Employees Paid in 2022? (https://www.salesforceben.com/how-


much-are-salesforce-employees-paid/)

© 2014-2022 SalesforceBen.com Back To Top

Privacy - Terms

You might also like