Salesforce Security – Field Level Security

Field Level Security settings in Salesforce give permissions at object level to administrators restrict user’s access to view and edit some certain fields. The fields that users see on detail and edit pages are a combination of page layouts and field level security settings.

Example :- Let us consider a scenario.

There are two users in my developer organization. User1 and User2.

User1User2
User1  – PrasanthUser2 –  Adarsh
Profile –  System AdministratorProfile – Custom – Sales Profile.
Object – InvoicesObject – Invoices
Page Layout –  Invoice Layoutpage Layout – Invoice Layout

Requirement :- We have to create a new field(Invoice Reg#) in Invoice Object. And it should be available only for system administrators and not for other profiles.

How to implement  Field Level Security in Salesforce?

When we create a new field and add to the page layout and the page layout is accessed by the both profiles so it is not the solution. Here we use the concept Field Level Security in Salesforce.

Create a Field in Invoice.

  • Let us create a field name called Invoice RegNo in Invoice Object

Field Level Security

  • Ente field label and Click on Next button.

Step3:- Establishing field level security.

Field Level Security in Salesforce

Now we are going to establish field level security in Salesforce. As we have a scenario that the field Invoice RegNo must be visible to system administrator only and not available to Custom Sales profile. Uncheck check box to custom salesforce profile and click on next button.

Salesforce Security - Field Level Security1

  • Click on Save button.

Now go to Invoice Object and create a record.

Salesforce Security - Field Level Security1

Field Configuration – View Field accessibility.

  • To check the field configurations go to field.

Field Level Security FLS

Click on Invoice RegNo as shown above.

Field Level Security FLS

  • Now click on View field accessibility button as shown above.

Field Level Security FLS

We can see the information for which this profile this field is editable and Hidden.

  • Click on Hidden as shown above.

FLS field level security

As the field is set to visible in page layout and not in Field level Security so the field is hidden for custom Sales Profile. This Invoice RegNo is available for system administrator profileNow login as User2 and create a new record in Invoice Object. We can see RegNo field in User2 this is because of Salesforce  Field Level Security.

Interview Question on Field Level Security.

  • What are the different options available in Field Level Security FLS?

In Field Level Security (FLS) we have to options they are Visible and Read Only.

  • What are features that we can control using Page Layouts?

In page layouts for any field we can control two feature they are Read-Only and Required.

  • Suppose if a field is set to visible in FLS and not visible in page layout settings then what will happen?

In this scenario, the field is not visible because of field level security.

Conclusion.

In this Salesforce tutorial we have learned about FLS field level security and how to make a field visible and Read Only using field level security in Salesforce. In our next Salesforce Tutorial we are going to learn about Permission Sets in Salesforce.