Sub topic 8
Grant Access Using Hierarchies and Custom Objects
This chapter assumes you know what org-wide defaults (OWD) are, how roles form a hierarchy, and how record ownership works. It covers the one setting that decides whether the hierarchy opens access upward for a given object.
What the setting does
The role hierarchy only grants access if the object's Grant Access Using Hierarchies setting is on. When it is on, users in higher roles get access to records owned by users below them. When it is off, the hierarchy is ignored for that object.
You find the setting in Setup under Sharing Settings, in the Organization-Wide Defaults section. Click Edit, and each object row has a checkbox in the Grant Access Using Hierarchies column.
Standard objects and custom objects
The behavior differs by object type.
| Object type | Grant Access Using Hierarchies | Can you turn it off? |
|---|---|---|
| Standard objects (Account, Contact, Opportunity, Case) | Always on | No |
| Custom objects | On by default | Yes |
For standard objects the hierarchy always applies. For custom objects you can clear the checkbox. The checkbox only matters when the OWD is restrictive, such as Private or Public Read Only. If the OWD is already Public Read/Write, everyone has full access and the hierarchy adds nothing.
Why turn it off
Turn it off when managers should not see their subordinates' records. Typical cases are HR records, performance reviews, or salary data. A custom object such as Compensation__c with a Private OWD and hierarchy access disabled means only the record owner, plus users with View All or Modify All, can see a record. Sharing rules and manual sharing can still open access, because those do not depend on the hierarchy.
Disabling the setting does not delete anything. Salesforce recalculates sharing, and the implicit hierarchy access is removed. Turning it back on restores the access after another recalculation.
Common errors
- Expecting a manager to see records after clearing the checkbox. The manager keeps access only through other mechanisms. Check for sharing rules and permissions like View All.
- Assuming the setting affects object permissions. It does not. A manager still needs the Read permission on the object. The hierarchy only affects record access.
- Looking for the checkbox on a standard object. It is always on and cannot be changed.
- Disabling it and forgetting reports. Managers' reports and dashboards will show fewer rows, because report results respect record access.
Checking the effect
After changing the setting, confirm with a query on UserRecordAccess. Replace the IDs with a manager's user ID and a record owned by one of their subordinates.
SELECT RecordId, HasReadAccess, HasEditAccess
FROM UserRecordAccess
WHERE UserId = '005XXXXXXXXXXXXXXX'
AND RecordId = 'a01XXXXXXXXXXXXXXX'With the setting on and a Private OWD, HasReadAccess is true for the manager. With the setting off and no other access, it is false.
Exercise
A custom object Review__c has a Private OWD and Grant Access Using Hierarchies cleared. A sales director sits above the record owner in the role hierarchy and has Read permission on the object, but not View All. Can the director open the record? Name two ways to give the director access without turning the setting back on.
Show answer
No. Without the hierarchy setting, the director has no implicit access to records owned by users below them. The director can be given access with a sharing rule that shares the records with the director's role or group, or with a manual share (or a team where the object supports it). Granting View All on the object would also work, but it opens every record, so it is broader.