There will be times, we all need to use OR operator in the validation rule in Salesforce. And here, I will explain how to use OR operator in the validation rule in Salesforce. We will also discuss, how to apply OR operator in the validation rule in Salesforce.
Recently, I was working in Salesforce, where we got a requirement to use OR operator in the validation rule in Salesforce. So, in this blog, I will also explain, how to use OR operator in the validation rule in Salesforce.
So, we will cover these topics in this Salesforce tutorial.
- What is the OR operator in Salesforce?
- How to use OR operator in validation rule in Salesforce
- How to use OR operator in validation rule in Salesforce lightning
- How to use OR operator in validation rule in Salesforce Classic
- How to apply OR operator in validation rule in Salesforce
- How to operate OR operator in validation rule in Salesforce
What is the OR operator in Salesforce?
The OR operator in salesforce decides if the expressions or statements are true or false. The OR operator returns a true value if any expression is true and it returns a false value if any expression is false.
Let’s understand the OR operator with the help of an example
Suppose, the HR Manager of the Baumbach-Sauer that is a USA-based company needs records of the Applicants that are working under some specific departments.
And they generated a google form that the applicant fill and the validation should be applied to it with the help of an OR Operator in Salesforce.
So, with this, we understand What is OR operator in Salesforce. Further, we will learn how to use OR operator in the validation rule in salesforce.
Read How to Use AND operator in Validation Rule in Salesforce
How to use OR operator in validation rule in Salesforce
The OR operator returns a true value if any expression is true and it returns a false value if any expression is false.
So, if you want to learn how to use OR operator in the validation rule follow these steps:-
- Login into Salesforce, Go to the gear icon then click on the setup after that click on the object manager tab which is present beside the home tab.
- After clicking on the object manager, the object manager page is open inside this page there are so many objects. Select one of the objects on which you are applying the validation rule by using OR operator.
- After selecting the object, the object page is open. On this page there is a New option, Click on it.
- Click on New after that fill the Validation rule edit information and then fill the Error formula condition in which we are using OR operator then describes the error message after that and click on save.
- After saving you can see that the object validation rule is created you can edit the information if you want simply click on the edit option.
Now, let’s move ahead and see how to use OR operator in the validation rule in Salesforce. We will explore both the salesforce experiences: Salesforce lightning and Salesforce Classic.
How to use OR operator in validation rule in Salesforce lightning
The Salesforce lightning is an advanced platform that specifies various business processes and it is a component-based structure for salesforce app development.
Follow the below steps on how to use OR operator in the validation rule in salesforce lightning:-
Step-1: Login to the salesforce account, go to the setup, and then click on the object manager which is present beside the home tab.

Step-2: After clicking on the object manager, the object manager page is open inside this page there are so many objects. Here we are selecting the Applicant object on which we are applying the validation rule by using OR operator.

Step-3: After clicking on the Applicant object, now click on the validation rule option that is present in the left sidebar.

Step-4: After clicking on the validation rules option, now click on the new option that is present on the right side.

Step-5: After clicking on New the applicant validation rule page is open inside this page there is the Validation rule edit, fill the Validation rule edit information. Firstly fill the rule name and description.

Step-6: After filling in the Validation rule information, now fill the information of the error condition formula. Here we are using OR operator and we select the ISBLANK function and then click on the insert field after that click on check syntax.
After clicking on check syntax it shows no error found. So we can move forward and do the next step.

Step-7: After filling the information of the error condition formula, now give the description of the error message and after that click on the save option.

Step-8: After clicking on the save option, the applicant validation rule page is open and you can see the complete applicant validation rule detail.

Step-9: Again click on the applicant object, and then select the New applicant and this applicant object is present on the nav bar.

Step-10: Now fill the information related to the applicant, here you can see that we can not fill the Applicant’s Name or tracking Email, and click on the save option the error message occurs. Review the errors on this page.

So, with this, we understand how to use OR operator in the validation rule in salesforce lightning.
Read Validation Rule for Name Field in Salesforce
How to use OR operator in validation rule in Salesforce Classic
Salesforce Classic is the traditional user experience of salesforce. It is purely used to distinguish between the older and modern user interface.
If you want to learn how to use OR operator in the validation rule in salesforce classic follow these steps:-
Step-1: Login into your Salesforce account, and go to the setup that is present in the top right corner of the salesforce classic.
On the left-hand sidebar there is the customize tab under the build app, click on the drop-down menu of customize then select the Leads object that is present under customize.
Under the Leads object there is a validation rule option, click on the validation rules.

Step-3: After clicking on the validation rule, the Leads validation rule page is open then click on the new option.

Step-4: After clicking on the new option, The new Leads validation rule page opens in which we can fill the information, firstly fill the rule name and then give the description and then move forward.
Here we are applying the validation rule on the First Name and Last Name.

Step-5: After filling the Validation rule information, now fill the information of the error condition formula. Here we are using OR operator and we select the ISBLANK function and then click on the insert field and after that click on check syntax.
After clicking on check syntax it shows no error found. So we can move forward and do the next step.

Step-6: After filling the information of the error condition formula, now give the description of the error message and after that click on the save option.

Step-7: After clicking on the save option, the Leads validation rule page is open and you can see the complete validation rule detail.

Step-8: Again click on the Leads object, and then select New Leads and this Leads object is present on the nav bar.
Now fill the information related to the Leads, here we can see fill the Last Name as Mayert and blank the First Name the error occurs on the screen.

Read How to create list view in Permission Set Salesforce
How to apply OR operator in validation rule in Salesforce
The OR operator returns a false value if any expression is false and it returns a true value if any expression is true.
If you want to learn how to apply OR operator in the validation rule in salesforce follow these steps:-
Step-1: Login into salesforce, go to the setup, and then click on the object manager which is present beside the home tab.

Step-2: After clicking on the object manager, the object manager page is open inside this page there are so many objects. Here we are selecting the USA Employee object on which we are applying the validation rule by using OR operator.

Step-3: After clicking on the USA Employee object, now click on the validation rule option that is present in the left sidebar.

Step-4: After clicking on the validation rules option, now click on the new option that is present on the right side.
After clicking on New the USA Employee validation rule page is open inside this page there is the Validation rule edit, fill in the Validation rule edit information. Firstly fill in the rule name and description.

Step-5: After filling the Validation rule information, now fill the information of the error condition formula. Here we are using OR operator and we select the ISBLANK and ISNEW functions and then click on the insert field after that click on check syntax.
After clicking on check syntax it shows no error found. So we can move forward and do the next step.

Step-6: After filling the information of the error condition formula, now give the description of the error message and after that click on the save option.

Step-7: After clicking on the save option, the USA Employee validation rule page is open and you can see the complete USA Employee validation rule detail.

Step-8: Again click on the USA Employee object, and then select the New USA Employee and this USA Employeee object is present on the nav bar.

Step-9: Now fill the information related to the USA Employeee, here you can see that we can not fill the Employeee Account number field, and click on the save option the error message occurs. Review the errors on this page.

This is how we have learned how to apply OR operator in the validation rule in salesforce.
Read How to create a list view in Salesforce
How to operate OR operator in validation rule in Salesforce
Here we see how to operate OR operator in the validation rule in salesforce. So, if you want to learn how to operate OR operator in the validation rule follow these steps:-
Step-1: Login into salesforce, go to the setup and then click on the object manager which is present beside the home tab.

Step-2: After clicking on the object manager, the object manager page is open inside this page there are so many objects. Here we are selecting the Product object on which we are applying the validation rule by using OR operator.

Step-3: After clicking on the Product object, now click on the validation rule option that is present in the left sidebar.

Step-4: After clicking on the validation rules option, now click on the new option that is present on the right side.

Step-5: After clicking on New the Product validation rule page is open inside this page there is the Validation rule edit, fill the Validation rule edit information. Firstly fill the rule name and description.

Step-6: After filling in the Validation rule information, now fill in the information of the error condition formula. Here we are using OR operator and selecting the ISBLANK and ISNUMBER functions and then clicking on the insert field after that click on check syntax.
After clicking on check syntax it shows no error found. So we can move forward and do the next step.

Step-7: After filling the information of the error condition formula, now give the description of the error message and after that click on the save option.

Step-8: After clicking on the save option, the Product validation rule page is open and you can see the complete Product validation rule detail.

Step-9: Again click on the Product object, and then select the New Product and this Account object is present on the nav bar.

Step-10: Now fill in the information related to the Product, here you can see that we fill the Product number field as an alphabetical manner and click on the save option the error message occurs.

So, with this, we understand how to operate OR operator in validation rule in salesforce.
Conclusion
In this tutorial, we have learned how to use OR operator in the validation rule in salesforce, and also we have covered how to append OR operator in the validation rule in salesforce. This can be performed on both salesforce lightning and salesforce classic.
- What is the OR operator in Salesforce?
- How to use OR operator in validation rule in Salesforce
- How to use OR operator in validation rule in Salesforce lightning
- How to use OR operator in validation rule in Salesforce Classic
- How to apply OR operator in validation rule in Salesforce
- How to operate OR operator in validation rule in Salesforce
You may like the following salesforce tutorials:
- How to Create Workflow Rule in Salesforce
- How to Duplicate a Report in Salesforce
- Create a Junction Object in Salesforce
- How to Use Chatter in Salesforce
- How to Create a Task in Salesforce
- How to Add Validation Rule for Text Field in Salesforce
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.