Understanding Field Level Security with practical hands-on
Table Of Contents
- What is Security in Salesforce?
- Field Level Security in Salesforce
- Creating the Teacher object
- Creating the Salary field on the Teacher object
- Creating the Teacher and Principal object and profile
- Result
- Conclusion
What is Security in Salesforce?
Security is a major aspect of any system. Be it a company running its business in a building, where only its employees are allowed to enter, or in the airport where luggages are checked for security to ensure safety of the passengers.
In salesforce too, security is a very important part and only those who are supposed to be accessing the application/feature should be able to access it. Field Level Security is a part of ensuring security in Salesforce.
There are multiple parts to ensuring that correct security is established in Salesforce. And it all starts from something called Profiles. The idea here is to provide the most restrictive access in the profile level and keep opening the access as needed while going down in the security hierarchy. Under the profile too there are different kinds of access which can be provided – Object level access, field level access, etc. The object level access on the profile decides whether the object should have Create, Read, Update, Delete access or no access at all. Once the object level access is set, then comes the Field Level Access. In this article, we will dive deep into Field Level access or Field Level Security in Salesforce.
Understanding Field Level Security through an Example
Field Level Security is an important concept in Salesforce, and as the name suggests, it is used to control the level of access to a field on an object. Let’s take the example of a School. There would be many teachers in a school and each would be having a different salary and the principal wouldn’t want all teachers to know each other’s salaries. However, the principal should be able to see the salaries of all teachers. In that case, for the Teacher profile, we make the salary field on Teacher object as hidden. And for the Principal profile, we make the salary field as Read-Only.
Creating the Teacher object
Let’s create the Teacher object now. To start, first login to your salesforce dev org. If you don’t have one, here’s how you can create it for yourself. And remember it’s FREE!
Once you are logged into your org, click on the Gear icon (it’s called Settings) in the top right corner.

Select Setup

Click on Object Manager

Select Create option and click on Custom Object.

Populate the Label as Teacher, and Plural Label as Teachers. Click anywhere and the Object Name will be populated automatically. Then Click on Save.

We have created the Teacher object. Now we need to create the Salary field on it.
Creating the Salary Field on the Teacher object
Go to Object Manager from Setup and Search for the Teacher object. Select Teacher in the below table that appears.

Click on Fields and Relationships

Click on New.

Select the Number option then Click on Next.

Type Salary under the Field Name and let everything else be as it is.

Click on Next.

Let everything be as it is and Click on Next.

Click on Save.

Creating Teacher and Principal Object and Profile
Let’s create two objects and two profiles – Teacher and Principal. The Teacher profile will not have access to the Salary field on the Teacher object but the Principal profile will have this access.
To configure this let’s go to the Principal profile and search for “Custom Field Level Security”. Beside the Teacher option, click View.

Click on Edit and Disable the Read Access option for the Salary field.

Now go to the Principal Profile and click on View for the Teacher object under Custom Field Level Security. But now we will not uncheck the read access but verify if they are enabled. If not, we will enable it.

Also make sure that for both the profiles, the object level setting has read access.
Result
Now when we login as a user with Teacher profile, we do not see the Salary field on the Teacher record.

But when we login as the Principal profile, we are able to see the Salary field on the Teacher object.

And this is a basic example of field level security in Salesforce.
Conclusion
So, we learnt in brief about security and also how to setup field level security in salesforce. There are even further levels of security for defining the record level accesses which we will learn in a different article.
Let me know your thoughts about this article. Comment below if you have any feedback or suggestion. Follow me on LinkedIn