Sub topic 1
Object, field and record access: where sharing fits
Salesforce checks several independent layers before it shows a user a piece of data. This chapter lays out those layers and shows where org-wide defaults and the role hierarchy sit among them. The later chapters in this tutorial cover each sharing mechanism in detail.
Prerequisites
This chapter assumes you can:
- Navigate Setup and open an object's settings.
- Name standard objects such as Account, Contact, Opportunity and Case.
- Explain at a basic level what a profile and a permission set are.
- Read a simple SOQL query. SOQL is Salesforce's query language, similar to SQL.
Three questions Salesforce asks
When a user opens a record, Salesforce answers three separate questions:
- Object access: Can this user work with this type of record at all? Profiles and permission sets grant the Create, Read, Edit and Delete permissions on each object.
- Field access: Can this user see or change this particular field? Field-level security, also set in profiles and permission sets, controls this.
- Record access: Can this user see this particular row of data? Sharing answers this one.
Object and field access describe the kind of data a user may touch. Record access describes which specific records they may touch. A sales user might have Read and Edit on Opportunity, yet see only the opportunities they own or that were shared with them.
Where sharing fits
Sharing is the record-level layer. It starts from a baseline and then opens access in steps:
- Org-wide defaults (OWD) set the most restrictive baseline for each object.
- The role hierarchy lets users higher in the hierarchy reach records owned by users below them.
- Sharing rules, teams and manual sharing open access further for people the hierarchy does not cover.
Sharing can only open access beyond the baseline. It never removes access that the OWD already gives. This is why the usual design approach is to set a restrictive OWD and open access only where there is a business need.
Both layers must agree
Object permission and record access work as a logical AND. A user needs both.
| Object permission | Record access | Result |
|---|---|---|
| Read on Account | Record is shared or owned | User can view the account |
| Read on Account | Record is not shared | User cannot see the account |
| No Read on Account | Record is shared | User cannot see the account |
A common mistake is to fix a "can't see the record" problem by widening the profile. If the user already has object Read, the missing piece is nearly always record access.
Exceptions that skip sharing
Two object permissions bypass the sharing layer. View All and Modify All on an object give access to every record of that object, whatever the OWD and role hierarchy say. The system permissions View All Data and Modify All Data do the same across all objects. Because they ignore sharing, grant them carefully. A later chapter covers them.
Checking your understanding of the model
You can test each layer separately in Setup:
- Look at a profile or permission set to see object and field permissions.
- Open Sharing Settings to see the OWD for each object.
- Open Roles to see the role hierarchy.
A later chapter shows how to confirm the combined result with queries on UserRecordAccess and the share tables.
Exercise
A user has Read and Edit on the Case object in their profile, and the OWD for Case is Private. The user does not own a particular case and sits in a role with no connection to the case owner. Can the user open that case? Which layer blocks them?
Show answer
No. Object permission is satisfied, so the profile is not the problem. Record access blocks them. The Private OWD allows only the owner (and users above the owner in the role hierarchy) to see the case, and nothing else shares it with this user. To fix it, open record access with a sharing rule, team or manual share, rather than changing the profile.