# What is a Hierarchical relationship and what unique object limitation does it possess in Salesforce?

**Topic:** Admin · **Difficulty:** Medium · **Tags:** Admin, Object Relationships, Hierarchical Relationship

Read it on the site: https://www.forcechallenges.com/interview-questions/what-is-a-hierarchical-relationship-and-what-unique-object-limitation-does-it-possess-in-salesforce

## Answer

**Basics:** When you create a relationship field on the User object, the type list includes Hierarchical. It links a user to another user, forming a tree. The standard Manager field is the built-in example. You can add custom ones, such as "Dotted-Line Manager" or "Mentor".

**How it works:**
1. Setup > Object Manager > User > Fields & Relationships > New.
2. Choose Hierarchical Relationship (it appears only for User).
3. Name it and set field-level security.
4. Populate it on user records (or via Data Loader).
5. Use it in automation: approval processes ("Use the Manager field"), flows (`$Record.Manager.Email`), formulas and Apex.

**Advanced / deep dive:** Hierarchical differs from a normal self-lookup: on other objects you can create a lookup to the same object (for example Account.ParentId is a standard self-lookup, and a custom object can look up to itself), but the special hierarchical type exists only for User. It does not give record access. Access in Salesforce is governed by Role Hierarchy (a separate tree defining data visibility) and the sharing model, not by the Manager field, although manager groups used in sharing and "Grant access using hierarchies" interplay with roles rather than the Manager field. Do not confuse the Role hierarchy with the user hierarchy. Account hierarchy views and Parent Account use a normal lookup. For querying, a user's manager chain can be walked in SOQL with relationship traversal, limited to five levels up (`Manager.Manager.Manager.Manager.Manager.Name`).

**Code / config example:**
```text
Approval process step: Next Approver Determined By = "Manager field"
Flow formula: {!$Record.Owner:User.Manager.Email}
SOQL: SELECT Name, Manager.Name, Manager.Manager.Name FROM User WHERE IsActive = true
```

**Hidden gotchas & must-remember points:**
- The Hierarchical type is not available on any object other than User.
- The Manager field does not grant data access; roles do.
- You can create several hierarchical fields on User, each its own relationship.
- Circular references (A manages B and B manages A) are not allowed by the standard Manager field validation; avoid them in custom ones too.
- Approval processes only auto-route to the standard Manager (and Delegated Approver) or a custom user field you select, not role hierarchy.
- Deactivated managers remain referenced, so approvals can stall; keep the field current.
- Wrong assumption to avoid: Hierarchical relationships are not for Account or Case trees.

**Best practice:** Keep the Manager field maintained through HR sync or SSO provisioning (SCIM or JIT attributes) so approvals and automation route correctly.

---
Source: ForceChallenges · last updated 2026-11-02
