Sub topic 2
Where FLS Applies: UI, Reports, List Views, Search, and APIs
Assume you know Salesforce objects, fields, records, users, Setup, and basic Apex and SOQL. Field-level security (FLS) controls whether a user can read or edit an individual field. It works alongside object permissions and record sharing.
Where FLS applies
FLS generally removes a field from these user-facing features when the user lacks Read access:
- Record pages and related lists
- Reports and report filters
- List views and list-view filters
- Search results and searchable fields
- API responses made in the user’s security context
Edit access is separate from Read access. A user might see a field but be unable to change it.
Page layouts are not security
A page layout controls which fields appear on a particular record page and whether they look read-only there. It does not protect data from reports, APIs, or other pages.
FLS is the security control. Use a page layout to improve the user experience after setting the correct FLS.
Required fields and permission set groups
Requiredness and FLS solve different problems. A required field must receive a value during record creation or update, but requiredness does not grant a user permission to read or edit the field. If a process requires a hidden field, populate it with automation or provide a controlled input path, then test the complete save process.
Permission set groups organize additive access. Create focused permission sets, such as Customer Support Fields or Finance Fields, and assign them through a group for a job function. Profiles provide the baseline; permission sets add access. Muting permissions can remove selected access from a group.
| Control | Main purpose |
|---|---|
| Permission set group | Bundle field permissions for a role |
Why Apex differs
Apex runs in system mode by default. Its SOQL and DML can bypass the running user’s FLS, so a controller must enforce access deliberately.
List<Account> accounts = [
SELECT Id, Name, AnnualRevenue
FROM Account
WITH USER_MODE
];WITH USER_MODE makes the query respect the user’s permissions. Without it, sensitive fields could be returned by an Apex method even when the UI hides them.
Exercise
A sensitive field is absent from a page layout but appears in an Apex response. What control is missing?
Show answer
Field-level security enforcement in the Apex code. Use user-mode SOQL, strip inaccessible fields, or an appropriate describe check.