Sub topic 1
Where field-level security fits in the Salesforce security model
Field-level security (FLS) decides whether a user can read or edit each individual field on an object. This chapter shows where FLS sits among the other access controls, so later chapters on configuring and enforcing it make sense.
Prerequisites
This chapter assumes you know:
- What objects, fields, records, and users are in Salesforce.
- How to open Setup and the Object Manager.
You do not need Apex yet. The code chapters come later.
The three layers of data access
Salesforce checks access in layers. A user must pass each layer to work with a value.
- Object permissions (CRUD). Can the user create, read, edit, or delete records of this object at all?
- Field-level security. For an object the user can reach, can they read or edit this specific field?
- Record access. For each record, can this user see it? Ownership, the role hierarchy, sharing rules, and manual sharing decide this.
Each layer answers a different question. Object permissions ask "which tables?", FLS asks "which columns?", and record access asks "which rows?"
How the layers combine
A user needs access at every layer. Suppose a sales rep has Read on Account and can see an Account record through sharing. If FLS hides AnnualRevenue, the rep sees the record but not that field. If the rep has no Read permission on Account, FLS is never reached, because the object is already blocked.
| Layer | Scope | Granted through |
|---|---|---|
| Object permissions | Whole object | Profiles, permission sets |
| Field-level security | One field | Profiles, permission sets |
| Record access | One record | Ownership, roles, sharing rules |
Object permissions and FLS are both stored in profiles and permission sets. Record access is configured separately, mainly through org-wide defaults, roles, and sharing rules.
What FLS controls
FLS has two settings per field, per profile or permission set:
- Read: the user can see the field's value.
- Edit: the user can change it. Edit requires Read.
Access is additive. If a user's profile hides a field but a permission set grants Read, the user can read it. Salesforce uses the most permissive result across everything assigned.
Common mistakes
- Treating record sharing as field protection. Sharing a record shows all the fields the user's FLS allows. It does not hide any others.
- Assuming FLS applies everywhere. The standard UI, reports, and APIs respect it. Apex code does not enforce it by default, which a later chapter covers.
- Granting Edit on a field without Edit on the object. The object permission still limits what the user can change.
Exercise
A user has Read on the Contact object and can see a Contact through a sharing rule. The Contact's Birthdate field has no Read access in any of the user's profile or permission sets. What does the user see, and which layer caused it?
Show answer
The user sees the Contact record but not the Birthdate field. Object permissions and record access both allow the record, and field-level security hides that one field.