Sub topic 7
Page layouts versus FLS: hiding is not securing
This chapter assumes you know how to set field access on profiles and permission sets, and that you can read basic Apex and SOQL. Here you will learn why removing a field from a page layout does not protect its data, and how to check what is actually exposed.
Two different controls
A page layout controls how a record page looks. It decides which fields, sections, and related lists appear, and whether a field is shown as read-only or required on that page.
Field-level security (FLS) controls whether a user can read or edit a field at all. Salesforce checks it in the UI, reports, list views, search, and the API.
The key difference is scope. A layout only affects one screen. FLS applies to the data wherever it is reached.
| Aspect | Page layout | Field-level security |
|---|---|---|
| Purpose | Organize the record page | Restrict access to the field |
| Scope | Record detail page only | UI, reports, search, API, and more |
| Assigned by | Profile and record type | Profile and permission sets |
| A security control? | No | Yes |
Why hiding is not securing
Suppose Internal_Notes__c is removed from the Account layout, but the field is still readable in the user's profile. The field disappears from the record page. A user can still reach it in several other ways:
- Add it as a column in a report or list view.
- Query it through the REST API, or through tools such as Data Loader.
- Find it in search results.
- Read it through a Lightning component or Apex code that does not check access.
Removing a field from a layout is a usability choice. If the data is sensitive, set FLS.
How they combine
A field appears and is editable on a record page only when both controls allow it.
FLS wins when the two disagree. If a field is on the layout but the user lacks Read access, the field does not appear. If the layout marks a field read-only but FLS grants Edit, the layout still makes it read-only on that page. In the API, though, FLS alone decides whether the user can edit it.
Checking for the gap
To find fields that are hidden by layout but not secured, compare each sensitive field's FLS settings with where it appears on layouts. In Setup, open the field in Object Manager and choose Set Field-Level Security to see which profiles can read and edit it. Then confirm that sensitive fields are not visible to anyone who should not see them.
Exercise
A team removes Salary__c from the Employee page layout for all profiles and considers the field "secured." Name two ways a user with Read access could still see the value, and state what the team should change.
Show answer
The user could add the field to a report or list view, or query it through the API. Search and Apex or Lightning code that does not enforce FLS are other routes. The team should remove Read access to Salary__c through FLS, in profiles or permission sets, for users who should not see it. The layout change alone does not restrict access.