Sub topic 3
Object permissions come first: profiles and permission sets
This chapter assumes you know basic Salesforce navigation and Setup, the standard objects (Account, Contact, Opportunity, Case), and what a user, profile and permission set are at a basic level. It also assumes you can read a simple SOQL query.
Why object permissions come first
Salesforce checks access in layers. Object permissions are the first layer. They decide whether a user can work with an object at all. Record-level sharing, which the rest of this tutorial covers, can only narrow or open access within what the object permissions allow.
Think of it as two gates:
- Object gate: Does the user have Read, Create, Edit or Delete on this object?
- Record gate: For a specific record, do org-wide defaults, ownership, the role hierarchy or sharing give access?
A user must pass both. If the object gate is closed, no sharing setting can open it.
The four object permissions
Each object has these basic permissions:
| Permission | What it allows |
|---|---|
| Read | View records the user can access |
| Create | Create new records |
| Edit | Update records the user can access |
| Delete | Delete records the user can access |
Notice the phrase "records the user can access". The permission applies only to records that sharing also lets the user reach. Edit on Account does not let a user edit every account. It lets them edit the accounts they can already see with edit-level access.
Profiles and permission sets
A profile is a set of permissions assigned to a user. Every user has exactly one profile. A permission set is a bundle of extra permissions. A user can have many permission sets, and they only add access.
The effective object permission is the combination of the profile and all assigned permission sets. If any one of them grants Read on Opportunity, the user has Read.
A common pattern is to keep profiles minimal and grant most access through permission sets. This makes it easier to give one person an extra capability without creating a new profile.
A worked example
Suppose Priya has a profile with Read on Account but no Create. Her team lead adds a permission set that grants Create and Edit on Account.
- Before the permission set, Priya can view accounts she can access. She cannot create one.
- After the permission set, she can create accounts and edit accounts she can already reach.
- If org-wide defaults make accounts Private and she does not own a given account, she still cannot see it, even with Edit.
You can confirm the result for one record with UserRecordAccess. It reports the access that remains after all permissions and sharing are applied.
SELECT RecordId, HasReadAccess, HasEditAccess, HasDeleteAccess
FROM UserRecordAccess
WHERE UserId = '005XXXXXXXXXXXXXXX'
AND RecordId = '001XXXXXXXXXXXXXXX'Replace both IDs with real ones from your org. A false value means either the object permission or the record access is missing, so check both.
Common errors
- Trying to fix a record problem with a profile change. If the user already has Read on the object but cannot see one record, the cause is sharing.
- Trying to fix an object problem with sharing. If the user gets an insufficient-privileges error on every record of an object, check the object permissions first.
- Assuming a permission set removes access. Permission sets only add access. To remove it, change the profile or take the permission set away.
Exercise
A user has Read and Edit on Opportunity through a permission set. Org-wide default for Opportunity is Private, and the user does not own a particular opportunity. Can the user edit it, and why?
Show answer
No. Object permissions are only the first gate. Under a Private default, the user needs ownership, a role hierarchy position above the owner, or a sharing grant to reach the record. Edit on the object does not provide that.