Field-level security
Until now, we have talked about record-level access; it refers to governing which records are accessible by users, including the OWD and sharing rule. Now we will go a step further and discuss how we can hide key fields from a group of users. Data is very important for any organization; it may contain highly sensitive information, such as bank account details. Salesforce allows you to use field-level security to make fields hidden or read only for a specific profile. There are three ways to set field-level security in Salesforce:
- From an object field
- From a profile
- Field accessibility
From an object field
A business scenario: Alok Sinfal is working as system administrator at Universal Containers. His manager Brigette Hyacinth wants to set the Rating field on the Lead object to be read-only for all users because they have a process created to auto-set the rating for lead objects based on a few fields.
Perform the following steps to solve the preceding business requirement:
- Click on Setup (gear icon) | Setup | PLATFORM TOOLS | Objects and Fields | Object Manager and then click on the Lead object.
- Now navigate to the Fields & Relationships section, and click on the Rating field.
- The next step is to click on the Set Field-Level Security button, as shown in the following screenshot. It will redirect you to a new page where you can set the field-level security:
- Select Visible and Read-Only for all profiles other than that of the System Administrator. For System Administrator, select only Visible, as shown in the following screenshot:
- Once you are done, click on Save.
Through profile
The field-level setting is also available on the profile. Perform the following steps to solve the preceding business requirement using profile settings:
- Click on Setup (gear icon) | Setup | ADMINISTRATION | Users | Profiles, then click on the System Administrator profile.
- Under the Apps section, click on Object Settings, and then select the Lead object.
- The next step is to click on Edit and navigate to the Field Permission section, as shown in the following screenshot:
From here you can set the Field-Level Security for Lead object fields.
Field accessibility
We can achieve a similar outcome by using Field Accessibility option. Perform the following steps to solve the preceding business requirement using Field Accessibility:
- Click on Setup (gear icon) | Setup | SETTINGS | Security | Field Accessibility.
- Click on the Lead object. It will redirect you to a new page where you can select View by Fields or View by Profiles.
- For the preceding business requirement, select View by Fields and then select the field Rating.
- Click on the Editable link as shown in the following screenshot:
- It will open the Lead Settings for Lead Field page, where you can edit the field-level security. Once done, click Save.