There will be times, we all need to add a validation rule for the name field in Salesforce. And here, I will explain how to add a validation rule for the name field in Salesforce. We will also discuss, how to add a validation rule for the last name field in Salesforce.
Recently, I was working in Salesforce, where we got a requirement to add a validation rule for the name field in Salesforce. So, in this blog, I will also explain, how to add a validation rule for the name field in Salesforce.
So, we will cover these topics in this Salesforce tutorial.
- What is the validation rule?
- Validation rule for name field in Salesforce
- Validation rule for name field in Salesforce lightning
- Validation rule for name field in Salesforce Classic
- Validation rule for the last name field in Salesforce
- Validation rule for unique name field in Salesforce
- Validation rule for user name field in Salesforce
- Validation rule for profile name field in Salesforce
What is the validation rule?
The validation rule verifies the data users enter in a record to meet the organization’s standards. A validation rule in salesforce holds a formula or expression that accesses the data in one or more fields and returns the value of True and False.
If the user enters an invalid input that is based on certain criteria the error message will display on the screen. Using the validation rule successfully gives quality data.
The validation rule gets evaluated irrespective of the medium from which you create the records.
For example, there is a USA-based company that created a google form and they want all the employees of the company can fill this google form. The validation is applied to the name of the employee if any one of the employees can forget to fill in their name and the name field is blank then an error occurs.
So, with this, we understand What is the validation rule for the name field in salesforce.
Read How to Use AND operator in Validation Rule in Salesforce
Validation rule for name field in Salesforce
A validation rule in salesforce holds a formula or expression that accesses the data in one or more fields and returns the value of True and False. It also verifies the data users enter in a record to meet the organization’s standards.
So, if you want to learn how to add a validation rule for the name field in salesforce follow these steps:-
- Firsltly, go to the setup and then click on the object manager which is present beside the home tab.
- After clicking on the object manager, then search for the object in the Quick Find Box after that click on the object.
- After clicking on the object, select the validation rule that is present on the left sidebar.
- After clicking on the validation rule, fill the all information that we require to complete the validation rule, then click on save.
- After clicking on save, now check if we do not fill the name field the error message is displayed on the top.
- If we fill the complete information and the information is correct then our validation rule is applied successfully.
Now, let’s move ahead and see how to add a validation rule for the name field in Salesforce. We will explore both the salesforce experiences: Salesforce lightning and Salesforce Classic.
Read How to create list view in community Salesforce
Validation rule for name field 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 add a validation rule for the name field in salesforce lightning:-
Step-1: First, 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, then search for the task object in the Quick Find Box after that click on the task object.

Step-3: After clicking on the task object, select the validation rule that is present on the left sidebar.

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

Step-5: After clicking on the new option, fill the information related to the validation rule edit, first fill in the Rule Name that is TaskName, and then fill the description.

Step-6: After editing, the validation rule then fills the error condition formula, and first selects the functions. Here we are selecting the ISBLANK function and then clicking on the insert field and after that clicking 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: Now fill the Error message by simply typing in the description box, then check the error location, and after that click on the save option.

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

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

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

This is how we understand the validation rule for the name field in salesforce lightning.
Read How to Avoid Creating Duplicate records in Salesforce
Validation rule for name field 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 add a validation rule for the last name field in salesforce classic:-
Step-1: First, go to the setup that is present in the top right corner of the salesforce classic.

Step-2: 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 the customize.
Under the Account object there is a validation rule option, click on the validation rules.

Step-3: After clicking on the validation rule, the Account validation rule page is open then click on the new 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.

Step-5: After edit, the validation rule then fills the error condition formula, first select the functions. Here we are selecting the ISBLANK function and then clicking on the insert field and after that clicking 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: Now fill the Error message by simply typing in the description box, then check the error location, and after that click on the save option.

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

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 task, here you can see that we can not fill the name field and click on the save option the error message occurs. Review the errors on this page.

In this way, we understand how to add a validation rule for the name field in salesforce classic.
Read How to create duplicate rule and matching rule in salesforce
Validation rule for the last name field in Salesforce
The Salesforce validation rule contains a formula or an expression that helps in summing up data. It also verifies the data users enter in a record to meet the organization’s standards.
Follow the below steps on how to add a validation rule for the last name field in salesforce:-
Step-1: First, 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, then search for the USA Employee object in the Quick Find Box after that click on the USA Employee object.

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

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

Step-5: After clicking on the new option, fill the information related to the validation rule edit, first fill in the Rule Name that is LastName, and then fill the description.

Step-6: After editing, the validation rule then fills the error condition formula, and first selects the functions. Here we are selecting the ISBLANK function and then clicking on the insert field and after that clicking 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: Now fill the Error message by simply typing in the description box, then check the error location, and after that click on the save option.

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

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

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

So, with this, we understand how to add a validation rule for the last name field in salesforce.
Read How to find duplicate records in Salesforce
Validation rule for unique name field in Salesforce
A validation rule in salesforce holds a formula or expression that accesses the data in one or more fields or unique fields and returns the value of True and False.
Follow the below steps on how to add a validation rule for the unique name field in salesforce classic:-
Step-1: First, 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, then search for the USA Employee object in the Quick Find Box after that click on the USA Employee object.

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

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

Step-5: After clicking on the new option, fill the information related to the validation rule edit, first fill in the Rule Name that is UniqueName, and then fill the description.

Step-6: After editing, the validation rule then fills the error condition formula, and first selects the functions. Here we are selecting the ISBLANK function and then clicking on the insert field and after that clicking 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: Now fill the Error message by simply typing in the description box, then check the error location, and after that click on the save option.

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

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

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

So, with this, we understand how to add a validation rule for the unique name field in salesforce.
Read How to Create Workflow Rule in Salesforce
Validation rule for user name field in Salesforce
The validation rule gets evaluated irrespective of the medium from which you create the records.
Follow the below steps on how to add a validation rule for user name field in salesforce classic:-
Step-1: First, 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, then search for the User object in the Quick Find Box after that click on the User object.

Step-3: After clicking on the User object, select the validation rule that is present on the left sidebar.

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

Step-5: After clicking on the new option, fill the information related to the validation rule edit, first fill in the Rule Name that is UniqueName, and then fill the description.

Step-6: After editing, the validation rule then fills the error condition formula, and first selects the functions. Here we are selecting the ISBLANK function and then clicking on the insert field and after that clicking 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: Now fill the Error message by simply typing in the description box, then check the error location, and after that click on the save option.

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

This is how we understand how to add a validation rule for user name field in salesforce.
Read How to Duplicate a Report in Salesforce
Validation rule for profile name field in Salesforce
The validation rule verifies the data users enter an invalid input that is based on certain criteria the error message will display on the screen. Using the validation rule successfully gives quality data.
Follow the below steps on how to add a validation rule for the profile name field in salesforce:-
Step-1: First, 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, then search for the profile object in the Quick Find Box after that click on the profile object.

Step-3: After clicking on the profile object, select the validation rule that is present on the left sidebar.

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

Step-5: After clicking on the new option, fill the information related to the validation rule edit, first fill in the Rule Name that is UniqueName, and then fill the description.

Step-6: After editing, the validation rule then fills the error condition formula, and first selects the functions. Here we are selecting the ISBLANK function and then clicking on the insert field and after that clicking 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: Now fill the Error message by simply typing in the description box, then check the error location, and after that click on the save option.

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

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

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

Conclusion
In this tutorial, we have learned how to add validation rule for name field in salesforce, and also we have covered how to add a validation rule for the last name field in salesforce. This can be performed on both salesforce lightning and salesforce classic.
- What is the validation rule?
- Validation rule for name field in Salesforce
- Validation rule for name field in Salesforce lightning
- Validation rule for name field in Salesforce Classic
- Validation rule for the last name field in Salesforce
- Validation rule for unique name field in Salesforce
- Validation rule for user name field in Salesforce
- Validation rule for profile name field in Salesforce
You may like the following salesforce tutorials:
- How to Create a Junction Object in Salesforce
- How to Use Chatter in Salesforce
- Create a Task in Salesforce
- How to Import Data into Salesforce
- How to use OR operator in Validation Rule in Salesforce
- How to Set Field-Level Security 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.