How to use OR operator in Validation Rule in Salesforce

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.

See also  Contact List View Salesforce [Lightning and 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.

How to use OR operator in validation rule in salesforce
How to use OR operator in validation rule in salesforce

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.

How to use OR operator in validation rule in salesforce lightning
How to use OR operator in validation rule in salesforce lightning

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

Use OR operator in validation rule in salesforce
Use OR operator in validation rule in salesforce

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

Use OR operator in validation rule in salesforce lightning
click on new option

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.

Salesforce use OR operator in validation rule
Validation rule edit

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.

Salesforce lightning use OR operator in validation rule
Error condition formula

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.

OR operator in validation rule in salesforce
Save the error message

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.

OR operator in validation rule in-salesforce lightning
OR operator in validation rule in-salesforce lightning

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

Salesforce OR operator in validation rule in salesforce
Click on new applicant

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.

Use of OR operator in validation rule in salesforce lightning
Use of OR operator in validation rule in salesforce lightning

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.

How to use OR operator in validation rule in salesforce classic
How to use OR operator in validation rule in salesforce classic

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

Use of OR operator in validation rule in salesforce classic
Use of OR operator in validation rule in salesforce classic

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.

See also  How to add lead source in salesforce

Here we are applying the validation rule on the First Name and Last Name.

Salesforce use OR operator in validation rule
Validation rule edit

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.

Salesforce classic use OR operator in validation rule
Error condition formula

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.

Salesforce OR operator in validation rule
Click on 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.

Salesforce classic use of OR operator in validation rule
Lead Validation rule

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.

So, with this, we understand how to use OR operator in the validation rule in salesforce classic.

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.

How to apply OR operator in validation rule in salesforce
How to apply OR operator in validation rule in salesforce

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.

How to apply OR operator in validation rule in salesforce lightning
How to apply OR operator in validation rule in salesforce lightning

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

Apply OR operator in validation rule in salesforce lightning
Select validation rule

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.

Apply OR operator in validation rule salesforce
Apply OR operator in validation rule salesforce

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.

Salesforce apply OR operator in validation rule
Error condition formula for employee

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.

Apply OR operation in validation rule in salesforce
Apply OR operation in validation rule in salesforce

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.

Apply OR operation in validation rule in salesforce lightning
Apply OR operation in validation rule in salesforce lightning

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.

Salesforce apply OR operator in validation rule
click on new employee option

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.

Salesforce apply or operator in validation rule
Salesforce apply or operator in validation rule

This is how we have learned how to apply OR operator in the validation rule in salesforce.

See also  How to Enable Entitlements 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.

How to operate OR operator in validation rule in salesforce
How to operate OR operator in validation rule in salesforce

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.

How to operate OR operator in validation rule in salesforce lightning
How to operate OR operator in validation rule in salesforce lightning

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

Operate OR operator in validation rule in salesforce
Click on validation rule

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

Operate OR operator in validation rule in salesforce lightning
Click on New option

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.

Salesforce operate OR operator in validation rule
Validation rule edit

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.

Salesforce lightning operate OR operator in validation rule
Error Syntax

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.

Operate the OR operator in validation rule in salesforce
Operate the OR operator in validation rule in salesforce

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.

Operate the OR operator in validation rule in salesforce lightning
Product validation rule

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

Salesforce operate the OR operator in validation rule
Click on new product

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.

Salesforce lightning operate the OR operator in validation rule
The error message display

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: