Sub topic 1
How Salesforce layers data access
Salesforce decides what a user can do with data in several independent layers. A user needs every relevant layer to allow an action. This chapter gives you the working model that the rest of the tutorial builds on.
Prerequisites
This chapter assumes you can:
- Navigate Setup and find objects, fields, and users.
- Describe standard and custom objects, records, and fields.
- Explain at a high level what profiles and permission sets are.
You do not need SOQL or Apex for this chapter. Later chapters use both in optional sections.
Two questions: objects and records
Salesforce access answers two separate questions.
- Can this user work with this kind of data at all? Object permissions and field-level security answer this.
- Can this user see or change this particular record? Record-level access answers this.
Object permissions come from profiles and permission sets. They grant Create, Read, Edit, and Delete on an object. Field-level security controls whether each field is visible or editable.
Record-level access is the subject of this tutorial. It comes from ownership, org-wide defaults, the role hierarchy, sharing rules, manual sharing, and teams.
How the layers combine
Object permissions are the gate. If a user's profile and permission sets give no Read access to Invoice, no record-level setting can show them an invoice. Record-level access then decides which invoices they see.
Record-level access starts restrictive and opens up. The baseline is the owner's access plus the org-wide default. Every other mechanism can only add access. None of them can take away access that a more restrictive layer already allows.
The record-level mechanisms
Each mechanism opens access in a different way.
| Mechanism | What it does |
|---|---|
| Record ownership | The owner gets full access to the record. |
| Org-wide defaults | Set the baseline access for users who do not own a record. |
| Role hierarchy | Gives users in higher roles the access of users below them. |
| Sharing rules | Share groups of records with groups, roles, or users, based on owner or field values. |
| Manual sharing | Lets a user share one record with another user or group. |
| Teams | Add users to one account, opportunity, or case with a team role. |
When several layers apply, the user gets the most permissive result. Access levels are Read Only and Read/Write, plus full access for the owner.
Why the layering matters
Choosing the wrong layer creates problems that are hard to see later. If you set org-wide defaults too open, you cannot close access with a sharing rule. If you use many manual shares, nobody can see the pattern behind them. You will use these ideas throughout the tutorial:
- Start with the most restrictive baseline that the business allows.
- Open access in the simplest mechanism that meets the need.
- Check object permissions first when a user reports missing records.
Exercise
Exercise
A user can open the Invoice tab but sees no invoices that belong to colleagues. Their profile grants Read on Invoice, and the org-wide default is Private. Which layer is limiting access, and which kinds of mechanism could open it?
Show answer
Record-level access is limiting it, because the Private default shows each user only the records they own. Object permission is not the problem, since Read is granted. Access can be opened with the role hierarchy, sharing rules, manual sharing, or teams, and the simplest one that meets the need should be chosen.