Sub topic 14
Finding out why a user can or cannot see a record
This chapter assumes you know org-wide defaults, the role hierarchy, sharing rules, manual sharing, and account teams. It also assumes you can read basic SOQL. The goal is a repeatable way to answer "why can this user see (or not see) this record?"
Work through the layers in order
Access is the union of several grants. A user needs object permission first. After that, any single record-level grant is enough. Check the layers in this order:
- Object permission. Does the profile or a permission set give Read on the object? Without it, no record is visible, whatever the sharing says.
- Org-wide default. If the default is Public Read Only or Public Read/Write, the user can already see every record. You can stop here.
- Ownership. Does the user own the record, or sit above the owner in the role hierarchy?
- Grants beyond ownership. Look for a sharing rule, a manual share, or a team membership that reaches the user, either directly or through a group or role.
- Overrides. The View All and Modify All permissions on the object, and View All Data and Modify All Data, bypass sharing entirely.
Read the share table
Each non-baseline grant on a custom object is stored as a row in its share object. For a custom object Invoice__Share, query by record:
SELECT Id, ParentId, UserOrGroupId, AccessLevel, RowCause
FROM Invoice__Share
WHERE ParentId = '<invoice record Id>'Each row tells you who has access, how much, and why:
| Field | What it tells you |
|---|---|
| `UserOrGroupId` | The user or group that received access. A group Id means you must check its members. |
| `AccessLevel` | Read or Edit. |
| `RowCause` | The reason: Owner, Manual, a sharing rule, or an Apex sharing reason. |
If UserOrGroupId is a group, a role, or a role and subordinates group, the user gets access only if they are a member of it. Query GroupMember to confirm.
Check team membership
Account team access is stored in AccountTeamMember, and the matching share row appears on AccountShare.
SELECT Id, AccountId, UserId, TeamMemberRole, AccountAccessLevel
FROM AccountTeamMember
WHERE AccountId = '<account record Id>'If the user is not listed, the team is not the source of their access.
Use the built-in tools
- Sharing button. On a record, click Sharing to see the current share rows. This works for objects whose default is not Public Read/Write.
- Field Access and object permissions. In Setup, open the user and check the profile and permission sets.
- Log in as the user. If your org allows it, this is the final test of what they truly see.
Common errors
- Blaming sharing for a permission problem. If the whole object is missing from the user's navigation, check object permissions, not sharing rules.
- Forgetting rules are recalculated. After a change in role, owner, or criteria field value, sharing may take time to update. Check whether a recalculation is still running.
- Assuming the hierarchy always applies. On custom objects, Grant Access Using Hierarchies can be switched off. Then managers above the owner get no access.
- Misreading Read and Edit. A user may see a record but not edit it because the strongest matching grant is Read.
Exercise
A user can open an Invoice record but cannot edit it. The org-wide default for Invoice is Private. Which two checks would you run first, and what would you look for?
Show answer
First, query Invoice__Share for the record's ParentId and look at the AccessLevel and RowCause of every row that reaches the user, directly or through a group they belong to. If the strongest AccessLevel is Read, that explains it. Second, check the user's profile and permission sets for Edit on Invoice, because without it they cannot edit even where sharing allows Edit.