Sub topic 3
View All, Modify All, and Salesforce Record Sharing
This chapter assumes you understand profiles, permission sets, roles, org-wide defaults, and basic SOQL. Salesforce combines these settings to decide whether a user can access a record.
Permissions that bypass sharing
View All is an object permission that lets a user see every record of that object. Modify All includes this access and lets the user edit, delete, and usually transfer every record of that object. These permissions bypass record-sharing rules, the role hierarchy, teams, and manual shares.
They do not automatically grant access to every object. A user still needs permission on the specific object. Field-level security can also restrict fields.
When normal sharing is not enough
Use a sharing rule when a group needs repeatable access to records owned by another group. Use a team when access belongs to a specific account, opportunity, or case. Use manual sharing for an exceptional, record-by-record grant.
External org-wide defaults
Experience Cloud and portal users can have separate external org-wide defaults. These settings control the baseline access that external users receive. Keep external access at Private or another restrictive level unless customers or partners must share records broadly.
Inspecting effective access
Use Setup's Sharing Settings and the record's Sharing button to inspect grants. SOQL can show the final result for a particular user:
SELECT RecordId, HasReadAccess, HasEditAccess, HasDeleteAccess
FROM UserRecordAccess
WHERE UserId = '005XXXXXXXXXXXXXXX'
AND RecordId = '001XXXXXXXXXXXXXXX'Share tables show individual grants and their causes:
SELECT Id, AccountId, UserOrGroupId, AccountAccessLevel, RowCause
FROM AccountShare
WHERE AccountId = '001XXXXXXXXXXXXXXX'Apex behavior and design
A class declared with sharing respects record-level sharing for its queries. A class declared without sharing does not enforce those sharing rules. Apex does not automatically enforce object or field permissions, so secure code must check those separately.
A manual share is represented by a share-table row with a RowCause, such as Manual. Start with restrictive org-wide defaults, keep the role hierarchy simple, and add targeted rules or teams only when a real business need exists.
Troubleshooting access
Check access in this order:
- Does the user have object and field permissions?
- Is the record owned by the user or someone above them in the hierarchy?
- What is the internal and external org-wide default?
- Does a sharing rule, team, or manual share grant access?
- Does
View AllorModify Allchange the result? - Is Apex using
with sharing?
Exercise
A user has Read access to Account but cannot see one account. What should you check first?
Show answer
Check the user's record access, the account's owner and hierarchy position, the Account org-wide default, and any sharing rule, team, or manual share. Also confirm that no restriction rule or external-user setting applies.