Sharing Model: OWD, Role Hierarchy & Sharing Rules
The sharing model is the foundation of Salesforce record-level security. It determines who can see and edit which records, and it is one of the most heavily tested areas on the CTA exam. A flawed sharing model cascades into performance issues, security holes, and governance nightmares.
How Record Access Works: The Sharing Stack
Section titled “How Record Access Works: The Sharing Stack”Record access in Salesforce is cumulative. You can open access but never restrict it below the baseline set by Organization-Wide Defaults (OWD). Each layer can only add access, never subtract it.
Record Access Calculation Flow
Section titled “Record Access Calculation Flow”When a user requests a record, Salesforce evaluates access through a specific sequence. Understanding this flow matters for debugging “why can/can’t this user see this record?” questions on the CTA board.
Detailed walkthrough
Each gate in this flowchart is a hard stop. If access is granted, evaluation ends immediately without checking remaining gates.
The first gate is OWD. If the object is Public Read/Write, the engine short-circuits and grants full access without touching the share table or role hierarchy. This is why Public Read/Write is attractive for high-volume objects: no sharing rows, no join, no calculation. The trade-off is that no record can be selectively restricted below that baseline.
If OWD is Private or Public Read Only, the engine checks record ownership. The owner always has full access. Ownership is a single indexed lookup on the OwnerId field, making it cheap and absolute. No sharing rule or Apex share can reduce the owner’s access.
The hierarchy gate comes next. The “Grant Access Using Hierarchies” checkbox controls it. When enabled (the default), any user above the record owner in the role hierarchy inherits access. When disabled, the hierarchy is bypassed entirely for that object. This toggle is commonly used for HR case data or compensation records. Candidates frequently assume hierarchy access is always on.
If none of the above gates fires, the engine queries the share table. Every declarative and programmatic sharing mechanism writes rows here: ownership-based rules, criteria-based rules, Account/Opportunity/Case team membership, territory assignments, manual shares, and Apex managed shares. The engine joins the share table against the pre-computed Group Membership Table, resolving all groups, roles, and territories the requesting user belongs to. If multiple rows match, the most permissive access level wins. On objects with millions of records and complex sharing rules, this join is the source of performance overhead.
The final gate is implicit sharing. If no explicit sharing row exists, Salesforce checks whether the requesting user owns a child record related to the parent. A Contact owner automatically gets Read access to the parent Account even if Account OWD is Private and no sharing rule covers them. The board question this enables: “If Account OWD is Private, can an Opportunity owner see the parent Account?” Yes, via implicit upward sharing. That may not be the intended behavior.
Organization-Wide Defaults (OWD)
Section titled “Organization-Wide Defaults (OWD)”OWD sets the baseline record access for every object. Every other sharing mechanism builds on top of this.
OWD Options
Section titled “OWD Options”| OWD Setting | Internal Users See | Internal Users Edit | External Users | When to Use |
|---|---|---|---|---|
| Private | Only own records | Only own records | Only own records | Default for sensitive data; most objects |
| Public Read Only | All records | Only own records | Varies by external OWD | Read-access is universal, edits are restricted |
| Public Read/Write | All records | All records | Varies by external OWD | No record-level restriction needed |
| Public Read/Write/Transfer | All records | All records + transfer | N/A | Leads/Cases where anyone can reassign |
| Controlled by Parent | Inherits from parent | Inherits from parent | Inherits from parent | Detail objects in master-detail relationships |
| Public Full Access | All records | All records + all | N/A | Campaigns only |
OWD Decision Framework
Section titled “OWD Decision Framework”OWD Trade-offs
Section titled “OWD Trade-offs”| Approach | Pros | Cons |
|---|---|---|
| Start Private, open up | Maximum security; add access as needed; easy to justify | More sharing rules to manage; sharing recalculation on rule changes |
| Start Public, lock down | Simple; no sharing rules needed; fast queries | Cannot restrict below OWD; security gaps; hard to audit |
| Per-object analysis | Right-sized security per object | Requires deep understanding of data sensitivity per object |
Role Hierarchy
Section titled “Role Hierarchy”The role hierarchy controls automatic upward record visibility. Users higher in the hierarchy can see records owned by users below them (when “Grant Access Using Hierarchies” is enabled).
Role Hierarchy Design Patterns
Section titled “Role Hierarchy Design Patterns”When to Use Each Pattern
Section titled “When to Use Each Pattern”| Pattern | Best For | Risks |
|---|---|---|
| Management-based | Companies where visibility follows reporting lines; simple orgs | Breaks when matrix organizations exist; people who report to multiple managers |
| Territory-based | Geographic or segment-based businesses; field sales | Deep hierarchies hurt performance; hard to represent cross-territory access |
| Hybrid | Most enterprise orgs; territory for sales, management for service | Added complexity; harder to explain and maintain; more sharing rules needed |
| Flat (2-3 levels) | Organizations using sharing rules heavily; portal-heavy orgs | Loses automatic upward visibility; requires explicit sharing rules for managers |
Role Hierarchy Design Guidelines
Section titled “Role Hierarchy Design Guidelines”- Keep it shallow. Aim for 5-7 levels maximum. Every level adds sharing calculation overhead.
- Align to data access patterns, not the HR org chart. The role hierarchy is NOT an org chart.
- One role per unique data access pattern. If two groups need identical access, they share a role.
- Plan for growth. Adding roles is easy; restructuring is painful (sharing recalculation).
- Disable hierarchy access selectively for sensitive objects (HR cases, compensation) by unchecking “Grant Access Using Hierarchies.”
Sharing Rules
Section titled “Sharing Rules”Sharing rules extend access beyond what OWD and role hierarchy provide. They are the primary tool for granting horizontal or cross-branch access.
Types of Sharing Rules
Section titled “Types of Sharing Rules”| Type | Based On | Can Share With | Use Case |
|---|---|---|---|
| Ownership-based | Record owner’s role/group | Roles, roles + subordinates, public groups | ”All records owned by Sales see also visible to Support” |
| Criteria-based | Field values on the record | Roles, roles + subordinates, public groups | ”All Accounts with Region = ‘West’ shared with West Sales Team” |
| Guest user sharing rules | Criteria on record fields | Guest user groups | Portal/community guest access (heavily restricted) |
Sharing Rules vs Alternatives
Section titled “Sharing Rules vs Alternatives”| Mechanism | When to Prefer | When to Avoid |
|---|---|---|
| Sharing rules | Predictable, pattern-based access; small-to-medium number of rules | Complex logic requiring field calculations; >50 rules per object |
| Teams | Collaborative access for specific records (Account/Opp/Case) | Broad access patterns; objects that don’t support teams |
| Manual sharing | Ad hoc, user-initiated sharing for individual records | Automated or systematic access; large-scale sharing |
| Apex sharing | Complex business logic; dynamic access based on calculations | Simple patterns that sharing rules can handle; maintenance burden |
Sharing Rule Limits and Performance
Section titled “Sharing Rule Limits and Performance”Implicit Sharing
Section titled “Implicit Sharing”Salesforce grants certain record access automatically based on data relationships. Implicit sharing happens without any explicit configuration, making it easy to overlook.
Implicit Sharing Rules
Section titled “Implicit Sharing Rules”| Scenario | Access Granted | Direction |
|---|---|---|
| Parent-child (Account-Contact/Opp/Case) | Account owner gets access to related Contacts, Opportunities, Cases | Parent to child (downward) |
| Child-parent | Contact/Opp/Case owner gets Read access to the parent Account | Child to parent (upward) |
| Portal user to Account | Portal users get Read access to their associated Account | Upward |
| Portal user’s Account owner | Account owner gets access to portal user’s data | Downward |
| Associated record sharing | Access to a record can grant access to related records | Lateral |
Apex Managed Sharing
Section titled “Apex Managed Sharing”When declarative sharing mechanisms (OWD, hierarchy, sharing rules, teams) fall short, Apex managed sharing provides programmatic control.
How Apex Managed Sharing Works
Section titled “How Apex Managed Sharing Works”- Records are shared by inserting rows into the object’s share table (e.g.,
AccountShare,CustomObject__Share) - The
RowCausefield must use an Apex Sharing Reason (defined on the object) - Shares with an Apex Sharing Reason survive ownership changes (unlike manual shares)
- Only shares created with the same Apex Sharing Reason can be modified by that Apex code
When to Use Apex Managed Sharing
Section titled “When to Use Apex Managed Sharing”| Scenario | Example |
|---|---|
| Complex business logic determines access | ”Share Accounts with the user who last interacted, based on Activity history” |
| Dynamic team composition | ”Share Cases with all users who have a specific skill certification” |
| Cross-object sharing logic | ”Share Opportunities with users who own related Project records” |
| External system drives access | ”Sharing based on territory assignments maintained in an external HR system” |
Apex Managed Sharing Code Pattern
Section titled “Apex Managed Sharing Code Pattern”// Create a share record with an Apex Sharing Reason (custom objects only)MyObject__Share shareRecord = new MyObject__Share();shareRecord.ParentId = recordId; // Record to shareshareRecord.UserOrGroupId = userId; // User or Group receiving accessshareRecord.AccessLevel = 'Edit'; // Read, Edit, or AllshareRecord.RowCause = Schema.MyObject__Share.RowCause.Territory_Alignment__c; // Apex Sharing Reasoninsert shareRecord;Account Teams and Opportunity Teams
Section titled “Account Teams and Opportunity Teams”Teams provide collaborative, record-specific access for Account and Opportunity objects.
Teams Comparison
Section titled “Teams Comparison”| Feature | Account Teams | Opportunity Teams | Case Teams |
|---|---|---|---|
| Configurable roles | Yes (custom team roles) | Yes (custom team roles) | Yes (predefined + custom) |
| Default teams | Yes (auto-add to new records) | Yes (auto-add from Account Team) | Yes (assignment rules) |
| Sharing access | Read Only, Read/Write | Read Only, Read/Write | Read/Write |
| Related object access | Contacts, Opportunities, Cases | N/A | N/A |
| Can be mass-updated | Yes (Data Loader) | Yes (Data Loader) | Yes |
When to Use Teams vs Sharing Rules
Section titled “When to Use Teams vs Sharing Rules”- Teams: When access varies per record and is determined by individual relationships (e.g., “this specific Account has a dedicated support engineer”)
- Sharing rules: When access follows a pattern across many records (e.g., “all Accounts in the West region are visible to the West Sales team”)
Territory Management and the Sharing Model
Section titled “Territory Management and the Sharing Model”Sales Territories (formerly Enterprise Territory Management) provides a parallel access model to the role hierarchy. It directly affects sharing calculations because territory assignments create additional share table entries.
For full architecture details, including the object model, hierarchy design, assignment rules, and scaling limits, see Territory Management Architecture.
Key interaction with the sharing model:
| Consideration | Role Hierarchy | Territory Management |
|---|---|---|
| Account assignment | Based on owner | Based on territory rules (multi-territory possible) |
| User in multiple groups | One role only | Multiple territories |
| Sharing calculation | Standard | Additional sharing calculations with more share table entries |
| Best for | Simple org structures | Complex sales organizations with overlapping territories |
Sharing Model Design Process
Section titled “Sharing Model Design Process”When designing a sharing model for a CTA scenario, follow this systematic approach:
Step-by-Step Design Process
Section titled “Step-by-Step Design Process”Common CTA Sharing Model Mistakes
Section titled “Common CTA Sharing Model Mistakes”- Setting OWD too open. Starting with Public Read/Write and trying to restrict. You cannot restrict below OWD.
- Confusing role hierarchy with org chart. The hierarchy is about data access, not reporting.
- Overusing manual sharing. It does not survive record ownership changes and cannot be automated.
- Ignoring implicit sharing. Forgetting that child record owners get Read access to parent Accounts.
- Too many sharing rules. This usually indicates the OWD or role hierarchy design is wrong.
- Ignoring external users. External OWD is separate and defaults to the internal OWD or more restrictive.
- Not considering LDV impact. Private OWD on high-volume objects creates massive share tables.
CTA Exam Relevance
Section titled “CTA Exam Relevance”Security (Domain 2) is the second highest failure domain on the CTA exam. The sharing model is the cornerstone.
What the board looks for:
- Systematic approach to OWD selection (not guessing)
- Role hierarchy designed for data access, not org chart
- Clear articulation of why each sharing mechanism was chosen
- Understanding of implicit sharing and its security implications
- Performance awareness, specifically sharing calculation impact on LDV
- Portal/external user sharing considerations
Common board questions:
- “Why did you choose Private OWD for this object?”
- “How would your sharing model change if they add 50,000 partner users?”
- “What happens to sharing when a record owner changes?”
- “How does your role hierarchy handle matrix management?”
Related Topics
Section titled “Related Topics”- Field & Object Security: permissions complement the sharing model
- Portal Security: external user sharing has special rules
- Programmatic Security: Apex sharing enforcement
- Decision Guides: flowcharts for OWD and sharing strategy selection
- Security Trade-offs: sharing model complexity vs performance
- Data Architecture: LDV impact on sharing calculations
Sources
Section titled “Sources”- Salesforce Help: Sharing Settings
- Salesforce Help: Role Hierarchy
- Salesforce Help: Sharing Rules
- Salesforce Help: Enterprise Territory Management
- Salesforce Architects: Record Access Architecture
- Salesforce Architects: Sharing and Visibility Designer Guide
- Salesforce Architects: Platform Sharing Architecture
- Salesforce Developers: Record-Level Access: Under the Hood
- Salesforce Help: Sales Territories Implementation Guide
Personal study notes for the Salesforce CTA exam. Content compiled from VJ's study notes, official Salesforce documentation, community sources, and online publicly available content, then organized and presented with AI assistance. Not affiliated with Salesforce. © 2025–2026 VJ Srivastava.