How to Use AND operator in Validation Rule in Salesforce

There will be times, we all need to use AND operator in the validation rule in Salesforce. And here, I will explain how to use AND operator in the validation rule in Salesforce. We will also discuss, how to apply AND operator in the validation rule in Salesforce.

Recently, I was working in Salesforce, where we got a requirement to use AND operator in the validation rule in Salesforce. So, in this blog, I will also explain, how to use AND operator in the validation rule in Salesforce.

So, we will cover these topics in this Salesforce tutorial.

  • What is AND operator in Salesforce?
  • How to use AND operator in validation rule in Salesforce
  • How to use AND operator in validation rule in Salesforce lightning
  • How to use AND operator in validation rule in Salesforce Classic
  • How to apply AND operator in validation rule in Salesforce
  • How to operate AND operator in validation rule in Salesforce

What is AND operator in Salesforce?

The AND operator is used to estimate if the two values are both true. The And operator is different from the Logical function And.

If all the values are true, the And operator returns the True response. If one or more values are false, the And operator returns a False response.

Now let’s understand the add operation in salesforce with the help of an example.

For example, there is an Aufderhar-Predovic USA-based company that applies AND operator in the validation rule, and the validation rule is applied in the form that is filled out by the company employees.

So, with this, we understand What is AND operator in salesforce. Further, we will learn how to use AND operator in validation rule in salesforce.

Also, check Validation Rule for Name Field in Salesforce

How to use AND operator in validation rule in Salesforce

AND operator is an operator with returns the True values if every value is true. If one or many values are false it returns a False value.

So, if you want to learn how to use AND operator in the validation rule follow these steps:-

  • Go to the gear icon, click on the setup, and then click on the Object Manager which is present behind the Home tab in the nav bar.
  • 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 AND operator.
  • After clicking on the object, now click on the validation rule option that is present in the left sidebar.
  • Click on New after that fill the Validation rule edit information and then fill the Error formula condition in which we are using AND operator then describe 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 just simply click on the edit option.

Now, let’s move ahead and see how to use AND operator in the validation rule in Salesforce. We will explore both the salesforce experiences: Salesforce lightning and Salesforce Classic.

See also  How to Mass Import Contacts into Salesforce

Read How to create list view in community Salesforce

How to use AND operator in validation rule in Salesforce lightning

Salesforce Lightning is a modern view of the salesforce platform that is fast, easy, and filled with a wide variety of options.

Follow the below steps on how to use AND operator in the validation rule in salesforce lightning:-

Step-1: First, go to the setup and then click on the object manager which is present beside the home tab.

How to use AND operator in the validation rule in salesforce
How to use AND operator in the 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 Opportunity object on which we are applying the validation rule by using AND operator.

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

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

Use AND operator in salesforce
Use AND operator 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 of AND operator in salesforce lightning
Click on new option of opportunity

Step-5: After clicking on New the opportunity 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 AND operator in validation rule in salesforce
Validation rule edit for opportunity

Step-6: After filling the Validation rule information, now fill the information of the error condition formula. Here we are using AND 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.

How to Use AND operator in Validation Rule in Salesforce
Error condition formula opportunity

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.

salesforce use AND operator in validation rule in salesforce
Save the error message for Opportunity

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

Salesforce lightning use AND operator in validation rule
Opportunity validation rule

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

Salesforce how to use AND operator in validation rule
Click on new opportunity

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

Salesforce AND operator in validation rule
Error message pop up

This is how we understand the use of AND operator in the validation rule in salesforce lightning.

Read How to Add Tab on Activity Tab in Salesforce

How to use AND operator in validation rule in Salesforce Classic

Salesforce classic is the traditional user experience of salesforce and before the salesforce lightning was introduced, it was the only salesforce experience.

Follow the below steps on how to use AND operator in the validation rule in salesforce classic:-

Step-1: First, 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 account object that is present under customize.

Under the Account object there is a validation rule option, click on the validation rules.

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

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

How to use AND operator in validation rule in salesforce
Click on the new account option

Step-4: After clicking on the new option, The new account 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 Merge Cases in Salesforce

Here we are applying the validation rule on the Account Number and Account site.

Salesforce use AND operation in validation rule
Validation rule edit for account

Step-5: After filling the Validation rule information, now fill the information of the error condition formula. Here we are using AND 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 AND operator in validation rule
Error condition formula for account

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 classic AND operator in validation rule
Save account error message

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

Use AND operator in validation rule in salesforce classic
Account validation rule

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

Now fill the information related to the account, here we can see fill the Account Name as USAtheron42 and also fill the Parent account.

And you can see that we can not fill the Account number and account site, click on the save option the error message occurs. Review the errors on this page.

How to use AND operator in validation rule salesforce
Account Error message occur

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

Read How to Merge Accounts in Salesforce

How to apply AND operator in validation rule in Salesforce

And operator returns a False response If one or more values are false and the And operator returns the True response If all the values are true.

Follow the below steps on how to apply AND operator in the validation rule in salesforce:-

Step-1: First, go to the setup and then click on the object manager which is present beside the home tab.

How to apply AND operator in validation rule in salesforce
How to apply AND 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 AND operator.

How to apply AND operator in validation rule in salesforce lightning
How to apply AND 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 AND in validation rule in salesforce
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.

Salesforce append AND operator in validation rule
Click on new option of USA Employee

Step-5: 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 AND in validation rule in salesforce lightning
Validation rule edit

Step-6: After filling the Validation rule information, now fill the information of the error condition formula. Here we are using AND 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 AND 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.

Salesforce lightning Apply AND in validation rule
Save error message

Step-8: 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.

AND Operator in svalidation rule in salesforce
USA Employee validation rule

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

Salesforce apply AND operator in validation rule
Click on new USA Employeee

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

How to apply AND operator in validation rule  in salesforce
Error message occurs

With this, we have learned how to apply AND operator in the validation rule in salesforce.

See also  How to delete global picklist value in Salesforce

Read How to Share a Report in Salesforce

How to operate AND operator in validation rule in Salesforce

Here we see how to operate AND operator in the validation rule in salesforce. So, if you want to learn how to operate AND operator in the validation rule follow these steps:-

Step-1: First, go to the setup and then click on the object manager which is present beside the home tab.

How to operate AND operator in validation rule in salesforce
How to operate AND 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 Account object on which we are applying the validation rule by using AND operator.

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

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

Operate AND operator in validation rule in Salesforce
Operate AND 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.

After clicking on New the Account 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.

Operate AND operator in validation rule in salesforce lightning
Validation rule edit

Step-5: After filling in the Validation rule information, now fill in the information of the error condition formula. Here we are using AND 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.

AND operator in validation rule in salesforce
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.

And operator in validation rule in salesforce lightning
Click on save option

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

operate AND operator in validation rule in salesforce lightning
Account validation rule is created

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

Salesforce operate AND operator in validation rule
Click on the new account

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

salesforce lightning operate AND operator in validation rule
salesforce lightning operate AND operator in validation rule

So, with this, we understand how to operate AND operator in validation rule in salesforce.

Conclusion

In this tutorial, we have learned how to use AND operator in the validation rule in salesforce, and also we have covered how to append ANd operator in the validation rule in salesforce. This can be performed on both salesforce lightning and salesforce classic.

  • What is AND operator in Salesforce?
  • How to use AND operator in validation rule in Salesforce
  • How to use AND operator in validation rule in Salesforce lightning
  • How to use AND operator in validation rule in Salesforce Classic
  • How to apply AND operator in validation rule in Salesforce
  • How to operate AND operator in validation rule in Salesforce

You may also like the following salesforce tutorials: