Sub topic 16
Troubleshooting: why can't this user see the record?
This chapter assumes you know the basics of Salesforce Setup, profiles and permission sets, and simple SOQL. It also assumes you have read the earlier chapters on org-wide defaults (OWD), roles, the role hierarchy, sharing rules and share tables. Here you will combine them into a repeatable method for diagnosing "I can't see this record" and "I can't edit this record" reports.
Start with the right question
A user who "can't see a record" can mean several different things. Pin down which one before you change any setting.
- The object tab or the object itself is missing. This is an object permission problem.
- The object opens, but this one record does not appear in lists, search or reports. This is a record access problem.
- The record opens, but a field is blank or hidden. This is a field-level security problem.
- The record opens but the Edit or Delete button is missing. This is either a record access level problem (Read only) or an object permission problem.
Ask for the record Id or URL, the user's name, and what they expected to do. Then work through the layers in order.
The diagnostic order
Access is checked in layers, and each layer can only narrow or widen what the earlier ones allow. Check them from the cheapest test to the most detailed.
Step 1: Object permissions
Sharing never grants more than the object permission allows. If the user's profile and permission sets do not give Read on Account, no sharing setting will show them an account.
To check, open the user in Setup, review the profile, and look at the permission sets assigned to them. Use the Object Settings page of each to confirm Read, Create, Edit and Delete. To edit a record, the user needs Edit on the object and Read/Write record access. To delete, they need Delete on the object and the right to delete that record.
Step 2: View All and Modify All
If the user has View All or Modify All on the object, or the system permissions View All Data or Modify All Data, they see every record. If a user with these permissions still cannot see a record, the cause is not sharing. Look at field-level security, record types, page layouts, or filters on the list view or report.
The reverse matters as well. If a user sees records you did not expect, check for these permissions first, because they bypass OWD, roles and sharing rules.
Step 3: The org-wide default
Look up the OWD for the object in Setup under Sharing Settings. If it is Public Read Only or Public Read/Write, every internal user with object Read can already see the record. If it is Private, access must come from ownership or one of the mechanisms below.
Remember that OWD is the most restrictive baseline. Other mechanisms only open access. Also check the external OWD if the user is a portal or Experience Cloud user, because their baseline can be stricter than the internal one.
Step 4: Ownership and the role hierarchy
With a Private OWD, a user sees a record if:
- They own it.
- They sit above the owner in the role hierarchy and Grant Access Using Hierarchies is on for the object.
- They are in a queue that owns the record, or in a group the record is shared with.
Check these details, because they cause most surprises:
- Who owns the record now? Ownership may have changed since the user last saw it.
- Does the user have a role? A user with no role is outside the hierarchy and gets no upward access.
- Is the user above the owner? A manager in the reporting line may sit in a sibling branch of the role hierarchy, not above.
- Is Grant Access Using Hierarchies enabled? Standard objects always grant hierarchy access. For custom objects you can turn it off.
- Is the owner a Customer Community or other external user? Hierarchy access does not always extend through external roles in the way internal roles do.
A role hierarchy is not a reporting line. Do not assume that "she is his manager" means "she can see his records." Open the role hierarchy in Setup and confirm the actual position.
Step 5: Sharing rules, teams and manual shares
If the hierarchy does not explain access, look for other mechanisms.
- Sharing rules: check owner-based and criteria-based rules for the object. Confirm the user belongs to the target public group, role or role and subordinates. Rules recalculate, so a recent change may still be processing.
- Account teams, opportunity teams and case teams: confirm the user is listed on the team for the record.
- Manual sharing: open the record, click Sharing, and look at the list.
- Implicit sharing: access to a child record can come from a parent. For example, access to an opportunity can give read access to the parent account.
Manual shares are fragile. Changing the record owner removes manual shares, so a user who could see a record last week may lose it after reassignment.
Inspect access with queries
Guessing is slow. Two queries answer most questions directly.
Ask the platform: UserRecordAccess
This query tells you the final result after all mechanisms are applied.
SELECT RecordId, HasReadAccess, HasEditAccess, HasDeleteAccess
FROM UserRecordAccess
WHERE UserId = '005XXXXXXXXXXXXXXX'
AND RecordId = '001XXXXXXXXXXXXXXX'Treat the output as the ground truth for sharing access. If HasReadAccess is true but the user still cannot see the record in the UI, the problem lies elsewhere, such as field-level security, a list view filter, or a search index delay. If it is false, continue to the share table.
Ask the share table: AccountShare
The share table shows why access exists.
SELECT Id, AccountId, UserOrGroupId, AccountAccessLevel, RowCause
FROM AccountShare
WHERE AccountId = '001XXXXXXXXXXXXXXX'Read the RowCause column:
| RowCause | Meaning |
|---|---|
| Owner | The row represents the owner's access. |
| Team | The user is on an account team. |
| Manual | Someone shared the record using the Sharing button, or Apex did. |
| Rule | A sharing rule produced the row. |
| ImplicitChild | Access derived from a child record. |
Look for a row whose UserOrGroupId is the user, or a group or role the user belongs to. Role hierarchy access does not always appear as its own row for the user. It is often represented by rows for the owner's role group, so an absent row for your user does not rule out hierarchy access. Rely on UserRecordAccess for the final answer, and use the share table to learn the reason.
For custom objects, the share table is named MyObject__Share, with ParentId in place of AccountId, AccessLevel in place of AccountAccessLevel, and RowCause as before. Share tables exist only for objects whose OWD is not Public Read/Write. If the OWD is Public Read/Write, there is no share table to query.
Common causes and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| No access to any record of an object | Missing object Read permission | Add it with a permission set |
| Sees record but cannot edit | Access level is Read, or object Edit is missing | Change the sharing rule's access level, or add Edit |
| Manager cannot see report's record | Manager is not above the report in the role hierarchy | Fix the roles, or add a sharing rule |
| Access lost after reassigning a record | Manual share removed on owner change | Replace it with a rule or team |
| Access varies between similar users | One user has no role, or sits in a different branch | Compare the two users' roles |
| Custom object ignores hierarchy | Grant Access Using Hierarchies is off | Enable it if the business wants it |
| Apex returns fewer rows than expected | Class runs `with sharing` | Review whether that is intended |
Apex and sharing
Code can also explain missing records. A class declared with sharing enforces the running user's record access, so queries return only the rows that user can see.
public with sharing class AccountReader {
public static List<Account> visibleAccounts() {
return [SELECT Id, Name, OwnerId FROM Account ORDER BY Name LIMIT 50];
}
}If a page backed by this class shows fewer accounts than an admin sees, the code is working as designed. Compare the user's access with UserRecordAccess before you change the class. Classes declared without sharing ignore record access, which can expose data, so use them sparingly and only with a clear reason.
Apex can also create manual shares. This is the same access a user would get from the Sharing button.
Account acc = [SELECT Id FROM Account LIMIT 1];
AccountShare share = new AccountShare();
share.AccountId = acc.Id;
share.UserOrGroupId = UserInfo.getUserId();
share.AccountAccessLevel = 'Read';
share.OpportunityAccessLevel = 'None';
share.RowCause = Schema.AccountShare.RowCause.Manual;
insert share;If a share row exists but has a RowCause you did not expect, trace which code or user created it.
Edge cases to check
- Recent changes: sharing rule and hierarchy changes trigger recalculation. Large orgs can take a while, and Setup shows the status of the recalculation.
- Inactive users: records owned by an inactive user still honor the hierarchy, but the owner's role may have changed.
- Queues: records owned by a queue are visible to queue members and, with hierarchy access, to the managers of those members.
- Profile versus permission set: a user can hold several permission sets, and permissions are cumulative. The result is the union of all of them, so a permission can come from an assignment you did not expect.
- Login As: with the setting enabled, an admin can log in as the user and reproduce the problem. This is often the fastest check of the final experience.
A worked example
A support manager, Dana, reports that she cannot open a case owned by Luis, one of her agents.
- Object permission: Dana's profile has Read on Case. Pass.
- View All and Modify All: none. Continue.
- OWD for Case: Private.
- Ownership: Luis owns it. Dana does not.
- Roles: Dana holds the role "Support Manager East". Luis holds "Support Agent West", which sits under "Support Manager West". Dana is not above him.
- Sharing rules and teams: no rule covers this case, and there is no case team.
UserRecordAccessfor Dana returnsHasReadAccess = false, which confirms the diagnosis.
The reporting line says Dana manages Luis, but the role hierarchy does not. The preferred fix is to correct Luis's role if he moved teams. If both managers need access long term, a sharing rule granting the West agents' cases to the East managers' group is better than a manual share, which would disappear on the next reassignment.
Exercise
A user has Read on Opportunity and a role, and the Opportunity OWD is Private. She cannot see an opportunity owned by a colleague in another branch. UserRecordAccess shows HasReadAccess = false, and the OpportunityShare table has no row for her or for any group she belongs to. List two different, narrow ways to give her access, and say which one survives a change of record owner.
Show answer
Create a sharing rule (owner-based or criteria-based) that shares those opportunities with a public group or role that contains her, or add her to the opportunity team for that record. Manual sharing through the Sharing button also works for one record. The sharing rule survives an owner change because it is evaluated against the new owner or the criteria. A manual share is removed when the owner changes. Opportunity team membership is tied to the record and persists through an owner change, although it must be added per record.
Exercise
UserRecordAccess shows HasReadAccess = true for a user and a record, yet the user says the record is not in her list view. Name two causes that are not sharing problems.
Show answer
The list view may have a filter, such as My Records, that excludes the record. Field-level security or record type visibility may hide the data she expects, or a search index delay may keep a new record out of search results. Checking the view's filters first is the quickest test.