Sub topic 3
Object permissions: Create, Read, Edit, Delete, View All, Modify All
This chapter assumes you can navigate Setup, know the difference between standard and custom objects, and have a basic idea of record sharing (org-wide defaults and roles). It covers the six object permissions, how they depend on each other, how they combine across a profile and permission sets, and the errors people commonly make with them.
What object permissions control
Object permissions decide which operations a user can perform on an object as a whole. They are the first gate a request passes through. If a user has no Read permission on Account, no sharing rule can show them an account record.
There are six permissions. Four are the familiar CRUD operations. Two are administrative overrides that ignore record sharing.
| Permission | API name in metadata | What it allows | Requires |
|---|---|---|---|
| Read | `allowRead` | View records the user can access through sharing | None |
| Create | `allowCreate` | Create new records | Read |
| Edit | `allowEdit` | Update records the user can access | Read |
| Delete | `allowDelete` | Delete records the user can access | Read and Edit |
| View All | `viewAllRecords` | View every record of the object, regardless of sharing | Read |
| Modify All | `modifyAllRecords` | Read, edit, delete, and transfer every record, regardless of sharing | Read, Create, Edit, Delete, View All |
The "Requires" column matters. Salesforce enforces these dependencies when you save. If you tick Delete in the UI, Read and Edit are ticked for you. If you clear Read, the others are cleared.
CRUD permissions and record access are two checks
The first four permissions answer "can this user perform this kind of operation on this object?" They do not answer "on which records?" That second question belongs to record sharing, covered in a later chapter.
A user needs both. Consider a user with Edit on Opportunity. If the org-wide default for Opportunity is Private and the user does not own a given opportunity, has no role access to it, and it is not shared with them, they cannot see or edit that record. The Edit permission is necessary but not sufficient.
View All and Modify All
View All and Modify All bypass the sharing model for one object. Use them when a role needs to see or manage all records of that object no matter who owns them.
- View All gives read access to all records of the object. It does not allow edits.
- Modify All gives full control of all records of the object, including delete and transfer of ownership.
There are also two org-wide permissions with the same names: View All Data and Modify All Data. These are system permissions that apply to every object at once. They are covered in the chapter on system and user permissions. The per-object versions are the narrower, safer choice.
View All and Modify All also affect parent-child behavior. On a master-detail relationship, a user needs access to the parent record for the child to be accessible. View All on the parent grants that access across all parents.
Reading the permissions in Metadata API format
Object permissions are stored as an objectPermissions element. This permission set grants only Read on Account:
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Account Viewer</label>
<description>Read-only access to Accounts and the Annual Revenue field</description>
<hasActivationRequired>false</hasActivationRequired>
<objectPermissions>
<allowCreate>false</allowCreate>
<allowDelete>false</allowDelete>
<allowEdit>false</allowEdit>
<allowRead>true</allowRead>
<modifyAllRecords>false</modifyAllRecords>
<object>Account</object>
<viewAllRecords>false</viewAllRecords>
</objectPermissions>
<fieldPermissions>
<editable>false</editable>
<field>Account.AnnualRevenue</field>
<readable>true</readable>
</fieldPermissions>
</PermissionSet>Each of the six flags appears once per object. The fieldPermissions block at the end is field-level security, which is the next chapter's subject. Object access and field access are separate. A user with Read on Account who has no field permission on AnnualRevenue will not see that field.
Where you set object permissions
You can set object permissions in two places.
- In a profile, under Object Settings. The profile is the baseline that every user has exactly one of.
- In a permission set, under Object Settings. Permission sets add access on top of the profile.
Both locations use the same six flags. The difference is how they combine, which is the most important rule in this chapter.
How permissions combine
Object permissions are additive. A user's effective permission on an object is the union of everything granted by their profile, every permission set assigned to them, and every permission set inside any permission set group assigned to them. If any source grants Read, the user has Read.
flowchart TDBecause the grant is a union, you cannot remove a permission by adding another permission set. A permission set cannot say "no delete". The only ways to take a permission away are to remove it from the source that grants it, to unassign that source, or, for permission set groups, to add a muting permission set to the group. Muting is covered in a later chapter.
The following diagram shows how the effective result forms.
Worked example
A support team needs to work with Cases. You design the access like this:
- The profile Minimum Access grants no Case access.
- A permission set
Case_Agentgrants Read, Create, and Edit on Case. - A permission set
Case_Managergrants Delete on Case and View All on Case.
A user with only Case_Agent can create and edit cases they can see through sharing. A user with both permission sets can also delete cases they can see, and can see every case. Delete needs Read and Edit, which Case_Agent already provides. If Case_Manager were assigned alone, Salesforce would require Read and Edit to be present in the same permission set, so you would set them there as well.
That last point is a common source of confusion. Dependencies are checked within the permission set you are saving, not across the user's combined access. Each permission set must be internally valid on its own. So a delta-style set that grants only Delete is not allowed. Include Read and Edit alongside it.
Common errors
- Assuming Edit shows all records. Edit applies only to records the user can already see. If a user "has Edit but cannot find the record", check sharing, not the permission.
- Granting Modify All to fix a visibility problem. The user usually needs View All, or a sharing rule. Modify All grants far more than needed.
- Trying to restrict by adding a permission set. Permissions are a union. To remove access, change the source of the grant or use a muting permission set within a group.
- Forgetting that a profile still grants access. Auditing only permission sets misses what the profile gives. Check both.
- Confusing object Modify All with Modify All Data. The first applies to one object. The second applies to the whole org.
- Missing the license. A user license or permission set license may not allow certain objects or permissions, so the setting cannot be enabled at all.
Checking effective access
To see what one user can do on an object, open the user record and use the "View Summary" option on the permission set assignments, or use the "Salesforce Help" page for your edition to find the "Access summary" tools. Where the tool is not available in your org, compare the profile and each assigned permission set by hand. In code, you can check the running user's access with the schema describe methods.
Schema.DescribeSObjectResult d = Account.SObjectType.getDescribe();
System.debug('Can read: ' + d.isAccessible());
System.debug('Can create: ' + d.isCreateable());
System.debug('Can update: ' + d.isUpdateable());
System.debug('Can delete: ' + d.isDeletable());These methods report on the current user's combined object permissions. They reflect the union described above. They do not tell you whether the user can see a particular record.
Exercise
A user's profile grants Read on Opportunity. They are assigned a permission set that grants Read, Edit, and Delete on Opportunity, and a second permission set that grants nothing on Opportunity. The org-wide default for Opportunity is Private, and the user is not in the owner's role hierarchy. Which operations can the user perform on an opportunity owned by a colleague who has not shared it?
Show answer
None. The user's effective object permissions are Read, Edit, and Delete, because permissions combine as a union. But those permissions only apply to records the user can access. With a Private default and no sharing path, the user cannot see the record, so no operation is possible. Granting View All on Opportunity would let them see it.
Exercise
You try to save a permission set that has Delete checked on Contact, with Read and Edit unchecked. What happens, and why?
Show answer
Salesforce does not allow it. Delete requires Read and Edit, so the dependencies are enforced when you save, and in the UI the required boxes are checked for you. Each permission set must be valid on its own.