Sub topic 4
What field-level security controls: Read and Edit
This chapter assumes you know Salesforce objects, fields, and records, and that you can find a field in the Object Manager. You should also know that profiles and permission sets grant access. Here you will learn what field-level security (FLS) grants and how Read and Edit combine.
The two settings
Field-level security is a per-field setting that decides what a user can do with one field on one object. It has two flags:
- Read: the user can see the field's value.
- Edit: the user can change the field's value. Edit always requires Read.
That gives three possible states for any field and any user.
| Read | Edit | What the user gets |
|---|---|---|
| Off | Off | The field is invisible. It does not appear in the UI, reports, or API results. |
| On | Off | The field is read-only. The user sees the value but cannot change it. |
| On | On | The user can see and change the value. |
The fourth combination, Edit on with Read off, does not exist. Turning on Edit turns on Read, and turning off Read turns off Edit.
How FLS relates to other controls
FLS works together with object permissions and record sharing. A user needs all of them to work with a field value:
- Object permission (create, read, edit, delete) on the object.
- Record access to the specific record, through ownership, sharing rules, or role hierarchy.
- Field access through FLS.
Each check can only narrow access. If a user has Edit on AnnualRevenue but only read access to the Account record, the field is still read-only for that record. If the user has no object read permission, FLS on its fields has no effect.
Where the setting is stored
FLS is granted, never denied. Each profile or permission set grants Read or Edit on a field, and a user's access is the union of everything they are assigned. If one permission set grants Read and another grants Edit, the user gets Edit. You cannot remove access with a second permission set. You must remove the grant from the one that provides it.
In metadata, a grant looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Account Notes Access</label>
<fieldPermissions>
<editable>true</editable>
<field>Account.Internal_Notes__c</field>
<readable>true</readable>
</fieldPermissions>
</PermissionSet>The readable and editable elements are the Read and Edit flags.
Common mistakes
- Expecting Edit to override a read-only record. Record access still applies.
- Assuming a second permission set can take access away. Access only accumulates.
- Treating FLS as a UI feature. It also applies to reports, search, and the API. Apex code is a notable exception, which later chapters cover.
Exercise
A user has Edit on Account.AnnualRevenue through one permission set, and a second permission set that grants only Read on the same field. What access does the user have, and why?
Show answer
The user has Edit. FLS access is additive, so the user receives the highest level granted by any assigned profile or permission set. The Read-only grant does not reduce it.