Validation Rule for Name Field in Salesforce

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.

validation rule for the name field in salesforce
validation rule for the name field in salesforce

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.

validation rule for the name field in salesforce lightning
validation rule for the name field in the salesforce lightning

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

select the validation rule for the name field in salesforce
select the validation rule for the name field in salesforce

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

Salesforce validation rule for the name field
click on the new option

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.

Validation rule edit

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.

Validation Rule for Name Field in Salesforce
Apply error condition formula

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.

Salesforce lightning validation rule for the name field
Error message

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

validation rule for the name field in salesforce is applied
validation rule for the name field in salesforce is applied

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

Add the validation rule for the name field in salesforce
click on the task object

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.

Validation rule for the name field in salesforce error message occur
Error message occurs

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.

Validation rule for the name field in salesforce classic
Validation rule for the name field in 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.

Select the validation rule for the name field in salesforce classic
Select the validation rule for the name field in salesforce classic

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

Salesforce validation rule for the name field
Click on new option in account

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.

salesforce classic validation rule for name field
validation rule edit in salesforce

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.

Validation rule for name field salesforce
Error condition formula

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.

validation rule for name field salesforce classic
error message in salesforce

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

Validation rule for the name field in salesforce classic is applied
The validation rule for the name field in salesforce classic is applied

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.

Error message occur in salesforce
Error message occur in salesforce

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.

Validation rule for the last name field in salesforce
Validation rule for the last name field in salesforce

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.

Validation rule for the last name field in salesforce lightning
Validation rule for the last name field in salesforce lightning

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

Select validation rule for the last name field in salesforce
Select validation rule for the last name field in salesforce

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

Salesforce validation rule   for last name field in salesforce
Click new option

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.

Vlaidation rule for last name field in salesforce lightning
Validation rule edit for USA Employeee

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.

Salesforce lightning validation rule for last name field
Error condition formula apply

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.

validation rule for last name field in salesforce lightning
Save the error message

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.

Validation rule for the last name field in salesforce applied
Validation rule for the last name field in salesforce applied

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.

Validation rule for the last name field in salesforce
Click on USA employeee object

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.

Salesforce validation rule for the last name field
Click on save error message is generated

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.

Validation rule for unique name field in Salesforce
Validation rule for unique name field in Salesforce

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.

Validation rule for unique name field in Salesforce lightning
Validation rule for unique name field in Salesforce lightning

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

Select validation rule for unique name field in Salesforce
Select validation rule for unique name field in Salesforce

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

Salesforce validation rule for unique name field
Click on the new option of USA Employee

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.

Salesforce lightning validation rule for unique name field
Validation rule edit for USA emp

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.

Validation rule for unique name field salesforce
Error condition for USA employee

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.

Save the error message of USA Employeee in salesforce
Save the error message of USA Employeee

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.

USA Employee Validation Rule for unique name field in salesforce
USA Employee Validation Rule

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.

Salesforce lightning Validation rule for unique name field
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 name field and click on the save option the error message occurs. Review the errors on this page.

Salesforce lightning Validation rule for unique name error message is occur
Error message occurs for the unique name field

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.

Validation rule for user name field in salesforce
Validation rule for user name field in salesforce

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.

Validation rule for user name field in salesforce lightning
Validation rule for user name field in salesforce lightning

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

Select validation rule for user name field in salesforce
Select validation rule for user name field in salesforce

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

Salesforce validation rule for user name field
Click on new for user object

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.

dalesforce lightning Validation rule for user name field
Validation rule edit for user

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.

Validation rule for user name field error formula condition in salesforce
Error condition formula of user

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.

Salesforce validation rule for user name field
Salesforce validation rule for user name field

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

Validation rule for user name field occur in salesforce
User Validation Rule

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.

Validation rule for profile name field in salesforce
Validation rule for profile name field in salesforce

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.

Validation rule for profile name field in salesforce lightning
Validation rule for profile name field in salesforce lightning

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

Select validation rule for profile name field in salesforce
Select validation rule for profile name field in salesforce

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

Salesforce lightning validation rule for profile name field
click on new option of profile

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.

Validation rule for profile name field slaesforce
Validation rule edit for profile

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.

Salesforce Validation rule for profile name field
Error condition formula for profile

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.

salesforce classic validation rule for profile name field
Profile validation rule

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

Validation rule for profile name field in salesforce classic
click on new profile

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.

Validation rule for profile name field salesforce lightning
Error message occur for profile

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: