
Salesforce Admin Tutorial Chapter – 10
Validation Rules
Validation rules are used in Salesforce to enforce users to enter correct information when creating and modifying records. It helps us to maintain the accuracy and the quality of the data stored.
Salesforce triggers validation rules before saving the data, allowing us to guarantee that no incorrect information exists in the database at any time.
Previous article, Salesforce Admin tutorial – 9, explains about Record Types.
In the free Developer edition, we can use up to 100 active validation rules per object. In the Unlimited edition, the limit increases to 500.
Let’s see an example of how validation rules are created using the standard Account object in our application. Currently, the Account object doesn’t enforce any rules and allows users to save records with only the account name while all the other fields are left blank.

We need to change this behavior to ensure the fields Rating, Phone, and Annual Revenue are never left blank in a record. We also need to make sure the format of the PAN Number adheres to a certain pattern. To achieve this, we can create a validation rule to check and validate these field states when creating records.
For this, first, go to the Account object on the Object Manager and open the Validation Rules pane. Choose the New option to start creating a new rule.

You can give the rule a relevant name and set it to Active.

Then, you have to enter the Error Condition Formula. We can use several built-in functions Salesforce provides to simplify this process. This includes functions like ISNULL, ISBLANK, and OR.
The formula that ensures the Phone field never stays blank is:
ISBLANK(Phone)
You can insert fields to the formula using the “Insert Field” button at the top.
To ensure the Annual Revenue is not null, use:
ISNULL(AnnualRevenue)
To ensure the Rating field is not blank:
ISBLANK(TEXT(Rating))
To ensure the PAN Number adheres to a specific format, use regex to create the rule like this:
NOT( Regex(PAN_Number__c, ‘[A-Z][A-Z][A-Z][A-Z]{0-9}{0-9}{0-9}{0-9}{0-9}[A-Z]’) )
Finally, you can combine all these rules with an OR function to ensure that Salesforce triggers an error whenever any of the above rules are violated by a record.
OR(ISBLANK(Phone), ISNULL(AnnualRevenue, ISBLANK(TEXT(Rating)), NOT( Regex(PAN_Number__c, ‘[A-Z][A-Z][A-Z][A-Z]{0-9}{0-9}{0-9}{0-9}{0-9}[A-Z]’) ))
You can check the syntax of the entered formula using the Check Syntax option.

Then, add an appropriate error message to display and choose the location it should be displayed in. After completing all that, you can save this new validation rule.

You can check how the rule works in action by creating or modifying records with the wrong formats.
Profiles
Profiles are used in Salesforce to define different sets of permissions granted to different users based on their responsibilities. It acts as an interface between the user and the org when accessing Salesforce features. The profile assigned to a user determines which objects and fields they are allowed to access and modify under different circumstances.
While Salesforce comes with numerous standard built-in profiles, you also have the ability to create custom ones according to your needs. Whether they are standard or custom profiles, each of them should be associated with a respective user license to be accessible.
To view a list of profiles available in your org, you can simply search for “profiles” and go to the Profiles pane listed under Users. You’ll be able to see the profile you’re currently assigned, System Administrator, with this view.

If you open this profile, you’ll see how it lists the different access permissions and page layouts associated with it by default. It’ll also give you different options to change these existing settings to create something more tailored to your needs.

Now, let’s see how you can create a custom profile on Salesforce.
The previous Profiles page gives you the option to create a new profile at the top of the page. It takes you to a page where you can pick an existing profile to clone as a way to get started quickly. Give the new profile a name and save it.

It takes you to the Profile details page where you can edit its permissions and page layouts to fit the requirements.
The top of the page also gives you a “View Users” button which takes you to a list of users currently assigned to this profile. Right now, our new custom profile’s user count is zero.

You can add new users to it one or multiple at a time. Let’s try the New User option which adds a single user to the profile.
Fill in the details of the user as appropriate. Select their proper user license and profile and set them to “Active.”

Finally, save the new user.

You can log in as this new user to Salesforce to test out if the permissions work as you assigned them during creation. To make things easy and test the profile while in your current System Administrator profile, enable “Administrators can log in as any user” in Login Access Policies and log in to the new custom profile from the Users pane.

Next article, Salesforce Admin tutorial – 11, explains about Permission Sets.