In this Salesforce tutorial, we will learn how to create the checkbox validation rule in Salesforce. In Salesforce we create the validation rule to apply specific criteria when the user enters the data into the required fields on records.
There is a company that is based in the USA and I am the HR Manager of the company. There are lots of vacancies in the company and for these vacancies, lots of employees can apply. As the HR Manager of the company, it’s my duty to set the job applications after checking the application and taking the interview.
This job application contains the checkbox field called a required background check. We want to make sure that if this checkbox is checked and the other checkbox field called Background Checked completed must also be checked.
If all these validation scenarios in the job application form field are valid then the form of the employee is given to the employer otherwise the form gets rejected.
If you want to learn the process of how to create the checkbox validation rule you have come to the right place and we learn this topic in both the editions in Salesforce Lightning and Salesforce Classic.
How to create the checkbox validation rule in Salesforce Lightning
We will learn how to create the checkbox validation rule in Salesforce Lightning. Let’s take an example to understand things more clearly. I am working in the company and as the lead of the team, I got a task related to the salary form. In the salary form, I need to apply a validation rule. In the salary form, there is a column closed date and a mandatory checkbox for the employee of the company to fill both columns.
If they fill both the columns like close date and mandatory check box then the salary is received the salary is not received. So I apply the validation rule if by mistake the field is skipped by the employees some message comes and remembers the employee to fill the field.
And we apply the validation rule on the mandatory field, if someone skips the mandatory checkbox the error message occurs. After checking the checkbox their salary form process is completed otherwise they are stuck on this page.
If you want to learn how to create the checkbox validation rule in Salesforce Lightning, follow these steps:
1: Here you can see that we log in to our Salesforce account, this is my Salesforce Lightning account. When we login into the account the Sales page is open but we want to move to the Setup page. For this click on the gear icon, this gear icon is present at the top right corner.
When we click on the gear icon the drop-down list opens, under this drop-down list there are two options. The first one is Setup and another one is Service Setup. Here we click on the Setup option.
After clicking on the Setup option the Setup page is open, under this Setup page there is an object manager tab that is present on the nav bar. Click on the object manager tab.

2: Here the Object Manager page is open. Under this object manager page, lots of objects are present, and we want to select one of the objects.
We can also choose the object by simply entering the object name in the search box that is present at the right top corner. And we are entering the opportunity object in the search box.
After searching the object the opportunity object comes at the top of the object manager page. Click on the opportunity object.

3: After clicking on the Opportunity object, the Opportunity object page is open. Under this page, there is detail related to the opportunity and on the left side of the object page there is lots of option present, and from these, there are lots of options. I selected the validation rule option. This validation rule helps in applying the validation on the fields.

4: After clicking on the validation rule option, the opportunity validation rule page is open. Now we want to create a new validation rule. For creating a new validation rule click on the new button that is present at the top right corner of the page.

5: After clicking on the new button, the New Opportunity validation page is open that defines a validation rule by specifying an error condition and a corresponding error message. The error condition is written as a boolean formula expression that returns true or false.
Here we are entering the complete details related to the Validation rule. First, fill in the rule name Here we are filling in the rule name as the mandatory field is a must then click on the active checkbox.

6: After filling in the rule name, scroll to the button and enter the error condition formula. Firstly select the function and we select the IsBLANK function and then insert the field which we want The field is not blank and here we are selecting the close date field.
After that, we select the Not function and after that, we select the if function and put all the conditions inside the if function after that applying the && operator and then select the mandatory field not equal to false. After entering the whole formula check the syntax by simply clicking on the check syntax button.
When we click on the check syntax button if anything needs to be amended. If not the syntax is correct and the message generated no error found.

7: After entering the error formula, scroll to the bottom of the page. There is an error message section. Where we can enter the error. The error message will appear when the error condition formula is true.
Now enter the error message in the error message field. Here we are entering the error message as The Mandatory field should be checked. This error message field can either appear at the top of the page or below a specific field on the page. After entering the error message now select the error location.
Here we select the field checkbox and then click on the field drop-down arrow. The drop-down list is open. Under this drop-down list, lots of fields are present. So under the all of fields, we are selecting the mandatory field. After selecting the field click on the save button that is present at the bottom of the page.

8: After saving the opportunity validation rule, the opportunity validation rule detail is created successfully and here we can see the rule name, error condition formula, error message, and error location shown on this page.
Here we can edit and clone the rule by simply clicking on the edit and clone button that is present at the center of the page.

9: Now go to the app launcher. Enter the sales in the search box. Click on the Sales option. The Sales page is open, under this sales page lots of objects are present on the nav bar. Select one of the objects, here we are selecting the opportunity object.
The opportunity page is open, we want to create a new record related to the opportunity, so click on the new button. The Opportunity information dialogue box is open. Fill in the complete information related to the opportunity.
First, fill the Opportunity name as Mandatory Event then select the type as Existing Customer – Upgrade after that Fill the lead source as Web and then fill the Close Date as 8/22/2023 after that fill the Stage as Prospecting, and after that fill the probability as 100%.
Here you can see that the mandatory checkbox is unchecked and we click on the save button.

10: After clicking on the save button, the error message occurs at the bottom of the page and near the cancel button. The mandatory checkbox that should be checked will be the error message. Review the following field mandatory.

11: For removing the error, check the checkbox for mandatory. After checking the checkbox click on the save button again.

12: After clicking on the save button the pop-up message comes at the top that is the opportunity Mandatory Event was created successfully.

In this way, we understand how to create the checkbox validation rule in Salesforce Lightning. Let’s Proceed and learn how to create the checkbox validation rule in Salesforce Classic.
Read Salesforce Checkbox Group
How to create the checkbox validation rule in Salesforce Classic
Here we will learn how to create the checkbox validation rule in Salesforce Classic. Let us take an example where we want to create a checkbox validation rule on the opportunity object in Salesforce.
In this example, we will assume that we have a custom checkbox field that is Key opportunity which indicates that else an opportunity is considered a key deal. We want to implement that if the key opportunity checkbox is checked, the estimated closed date field must be occupied.
Now, we discuss the steps related to how to create a checkbox validation rule in Salesforce Classic. If you learn how to create it follow the complete steps.
Step-1: We already logged in to the Salesforce Lightning account but now we want to switch to the Salesforce Classic account. For switching to the Salesforce Classic account.
Click on the profile picture, After clicking on the profile picture the drop-down list is open. Under this drop-down list there is a switch to the Salesforce Classic option click on the switch to Salesforce Classic option. The Salesforce Classic org is open. Here we can see there is a username present at the top of the org.
Click on the drop-down arrow of the username. The username drop-down list is open. Under this drop-down list, there is a Setup option. Click on the Setup option. The Setup page is open, Under this setup page is Quick Find Box is present on the left side.
Enter the opportunity object in the Quick Find box, the opportunity object comes at the top, and this opportunity object is present under the Customize app. Under this opportunity object, there are lots of options present Select one of the options. Here we are selecting the validation rule option.

Step-2: After clicking on the Validation rule option, the opportunity validation rule page is open. Now we want to create a new validation rule. To create a new validation rule, click on the new button that is present at the center of the page of the Opportunity validation rule.
This validation rule helps improve data quality by preventing users from saving incorrect data. Validation rules are executed at record save time.

Step-3: After clicking on the new button, the New Opportunity validation page is open that defines a validation rule by specifying an error condition and a corresponding error message. The error condition is written as a boolean formula expression that returns true or false.
When the formula expression returns true, the save will be aborted and the error message will be displayed. The user can correct the error message and try again.
Here we are entering the complete details related to the Validation rule. First, fill the rule name here we are filling in the rule name as the Key opportunity field is must checked then click on the active checkbox.
After clicking on the active checkbox there is a description field fill the description fill if you want to fill otherwise the description field is as it is.

Step-4: After filling in the rule name, and checking the active checkbox scroll to the button and enter the error condition formula. Firstly select the operator and we are select the AND operator and then insert the field that we want The field is not blank and here we are selecting the Key Opportunity field.
After that, we select the function, on the right side there are All Function Categories. Select one of the functions inside the function list. Here we select the ISBLANK function then insert the field that we want and here we are inserting the Estimated Closed Date field.
Key Opportunity = TRUE checks if the key opportunity checkbox is checked.
ISBLANK(Estimated Closed Date) checks if the estimated closed date field is blank.
The validation rule uses the AND function to combine two conditions. If both conditions are met, the key opportunity checkbox is checked but the estimated closed date field is blank. If the user wants to save the record the validation rule will trigger and the user will not be able to save the opportunity record till the criteria are met.
After entering the whole formula check the syntax by simply clicking on the check syntax button. When we click on the check syntax button if anything needs to be amended. If not the syntax is correct and the message generated no error found.

Step-5: After entering the error formula, again scroll to the bottom of the page. There is an error message section. Where we can enter the error. The error message will appear when the error condition formula is true.
Now enter the error message in the error message field. Here we are entering the error message as The Key Opportunity is checked, and the Estimated Closed Date must be populated.
This error message field can either appear at the top of the page or below a specific field on the page. After entering the error message now select the error location. Here we select the field checkbox and then click on the field drop-down arrow.
The drop-down list is open. Under this drop-down list, lots of fields are present. So under the all of fields, we are selecting the Estimated Closed Date. After selecting the field click on the save button that is present at the bottom of the page.

Step-6: After saving the Key opportunity validation rule, the opportunity validation rule detail is created successfully.
Here we can see the rule name as Key opportunity field must be checked, error condition formula, error message as The Key Opportunity is checked, and the Estimated Closed Date must be populated, and error location as Estimated Closed Date is shown on this page.
Here we can edit and clone the rule by simply clicking on the edit and clone button that is present at the center of the page.

Step-7: Now again go to the home page of Salesforce Classic. We can see that on the home page, there are lots of objects present on the nav bar. Select the opportunity object. After clicking on the opportunity object.
The opportunity page is open, we want to create a new record related to the opportunity, so click on the new button. The Opportunity information dialogue box is open. Fill the complete information related to the opportunity.
First, fill the Opportunity name as Key Opportunity Deal then select the type as Existing Customer – Upgrade after that Fill the lead source as Web and then fill the Amount as 1000000 after that select the Close Date as 8/24/2023 after that fill the Stage as Qualification, and after that fill the probability as 10%.
Here you can see that the Key opportunity checkbox is checked and the Estimated Closed Date is empty after that we click on the save button.

Step-8: After clicking on the save button, the error message occurs at the top of the page and below the estimated Closed date field. The Key opportunity checkbox is checked but the estimated closed date field is blank.
If we want to save the record the validation rule will trigger and the user will not be able to save the opportunity record till the criteria are met and an error message will occur. At the top of the page the error message is shown as Invalid Data, Review all the error messages below to correct your data.
Below the Estimated closed date field the error message occurs as The Key opportunity is checked and the estimated close date field must be populated.

Step-9: To remove the error, Fill the estimated closed date field by simply clicking on the calendar icon and selecting the date from the calendar. After selecting the date the estimated closed date is filled then click on the save button again.

Step-10: After clicking the save button. Our Key Opportunity Deal page is open, under this Key Opportunity deal page detail related to the opportunity is shown. And we can successfully remove our error message from the record.

So with this, we learned how to create the checkbox validation rule in Salesforce Classic.
Conclusion:
The validation rule specifies an error condition and a corresponding error message. The error condition is written as a boolean formula expression that returns true or false.
The save will be aborted and the error message will be displayed. The user can correct the error and try again. It can help improve data quality by preventing users from saving incorrect data.
I hope you read the complete article and we get the complete idea related to the checkbox validation rule in Salesforce. The validation rule formula field has a feature to correct the formula.
We can check whether the formula that we enter in the field is correct or not by simply clicking on the check syntax button that is present below the formula field and this button is attached to the formula field.
I have also explained all the steps of creating the checkbox validation rule in Salesforce Lightning and Salesforce Classic.
You may like to read:
- Salesforce Checkbox Formula
- How to Create a Checkbox Field in Salesforce
- Salesforce Checkbox Default Value
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.