← Back to Security & Compliance
SEC-015 Security & Compliance 18 min read For: Salesforce Solution Architects

Role Hierarchy Design: Balancing Security and Reporting Access

Architecting the visibility tree to maintain strict data segregation while avoiding sharing calculations bottlenecks at scale.

VS

Vishal Sharma

Salesforce Architecture Specialist · Updated May 2026

What you will learn in this tutorial
  • Analyse the dual mechanics of the Role Hierarchy: security enforcement versus data aggregation.
  • Delineate how role updates trigger extensive background sharing recalculations and lock sharing tables.
  • Address large data volume (LDV) risks including ownership skew and locking bottlenecks.
  • Implement architectural design rules to reduce role counts and isolate partner portal users.
  • Evaluate alternative sharing mechanisms including Public Groups, Territory Management, and Team Sharing.
  • Configure collaborative forecasting and reporting boundaries without expanding the role structure.

1. The Dual Imperatives of Role Hierarchy: Security versus Analytics

The Salesforce Role Hierarchy is one of the most powerful declarative security features on the platform. It automatically escalates record access to users who sit above record owners in the hierarchy. For example, if a sales representative owns a lead, their manager automatically inherits read/write access to that lead, assuming standard Grant Access Using Hierarchies is enabled on that sObject.

However, organisations frequently fall into the trap of using the Role Hierarchy for two incompatible purposes: strict data security enforcement and analytical reporting or management reporting. Business leaders often assume that because a manager needs to view a report on a team's activity, that manager's team must sit directly below them in the security hierarchy. This is a critical misconception.

An organisation chart is rarely a good model for a role hierarchy. Business management maps reporting structures, while security architects map data visibility. If you design your role hierarchy to mirror your entire organisational chart, you will end up with a highly complex, deep, and fragile tree that degrades system performance and creates administrative nightmares. By customising the hierarchy to focus solely on data visibility boundaries, architects can maintain a clean, high-performing platform that supports both security and analytics.

2. Behind the Scenes: How Role Modifications Trigger Sharing Recalculations

To understand why complex role hierarchies degrade performance, we must look at Salesforce's underlying database mechanics. The platform operates on a multi-tenant architecture where data must be isolated and partitioned efficiently at scale. When security rules are modified, the system performs extensive database recalculations in the background.

Salesforce stores record visibility in a hidden table called the Object Sharing Table (e.g., AccountShare or OpportunityShare). When a user owns a record or is granted access via sharing rules, Salesforce writes rows to this table. The system also maintains a Group Membership Table, which records who belongs to what public groups, roles, and territories.

When you modify the role hierarchy (e.g., moving a role from one branch to another, or changing a user's role), Salesforce must recalculate the entire sharing tree. If your hierarchy is deep and contains hundreds of roles and millions of records, a single role change can trigger an extensive background sharing recalculation. This recalculates group memberships, updates sharing rows, and locks the sharing tables. This locking behaviour can cause UI freezes, API timeouts, and failed integrations, highlighting the need for flat, streamlined role structures.

3. Ownership Skew and Large Data Volumes: Avoiding Architectural Pitfalls

In large-scale implementations containing Large Data Volumes (LDV), improper role assignment can lead to critical performance bottlenecks known as Ownership Skew. This is one of the most severe performance bottlenecks in enterprise Salesforce deployments.

Ownership Skew occurs when a single user (or a small group of users) owns more than 10,000 records of a specific sObject type. If that owner is placed in a role that sits high in the role hierarchy, or is shifted within the hierarchy, Salesforce must recalculate sharing for all those records. This recalculation can take hours and lock system tables, preventing other users from creating or modifying records. Let us see an Apex pattern that highlights how programmatic inserts can dynamically route record ownership to avoid skew:

public class RecordOwnerAssignment {
    // Dynamically assign record owner to a system user with a flat role to prevent ownership skew
    public void assignSafeOwner(List accounts, Id safeSystemUserId) {
        for (Account acc : accounts) {
            acc.OwnerId = safeSystemUserId;
        }
        // Save records using modern DML enforcement and explicit user mode
        Database.insert(accounts, AccessLevel.USER_MODE);
    }
}

To prevent ownership skew, organisations must implement the following design rules: 1. Assign Skewed Owners to Roles at the Bottom: If a system user or integration user must own a massive volume of records, do not assign them a role, or place them in a role at the absolute bottom of the hierarchy that has no children. 2. Avoid High-Level Ownership: Ensure high-level executives or managers do not directly own data; let the data be owned by operations staff or integration accounts, and escalated via sharing rules. This keeps the top of your hierarchy extremely light and agile.

4. Architectural Strategy: Minimising Roles and Separating Portals

The golden rule of Role Hierarchy design is: Keep it as flat and simple as possible. Architects should challenge the creation of any new role, ensuring that alternate security controls are exhausted before adding complexity to the tree.

Architects should challenge the creation of any new role. Instead of creating distinct roles for every department and team (e.g., "North London Junior Account Executive"), standardise on broader roles (e.g., "UK Sales Rep") and differentiate access using Permission Sets and public groups. This reduces the number of nodes in the sharing tree and dramatically optimises recalculation speeds.

Additionally, you must separate internal employee hierarchies from external portal or partner hierarchies. External portal users (Experience Cloud) can generate thousands of roles if Partner Super User or Account Role options are not carefully managed. To prevent portal roles from clogging your internal sharing engine, implement User Role Limitation settings and utilise Sharing Sets or Share Groups. Sharing Sets completely bypass the role hierarchy for high-volume customer community licences, routing access through efficient lookup relations instead of database sharing tables.

5. Alternative Access Controls: Enforcing Reporting and Forecasting Segregation

If we cannot use the Role Hierarchy to structure our analytical reporting, how do we support managers who need to view reports and forecasts for their teams? Salesforce provides several robust, native features designed to solve this exact problem without adding burden to the sharing calculations engine.

Salesforce provides excellent alternative mechanisms that do not rely on the Role Hierarchy: - Collaborative Forecasting: This tool uses a separate forecasting hierarchy. You can structure your forecasting tree to match your management chart while keeping the security role hierarchy flat and efficient. - Enterprise Territory Management (ETM): ETM allows you to model complex, multi-dimensional sales structures (by region, product, and industry) separate from the role hierarchy. Record access and reporting are determined by territory membership, leaving your role hierarchy streamlined. - Public Groups and Team Sharing: To grant horizontal visibility across teams, use Account Teams, Opportunity Teams, or manual sharing rules backed by public groups, rather than moving users up and down the role hierarchy.

By decoupling reporting from visibility, you build a high-performance, compliant, and scalable Salesforce architecture. Standardising on these alternative patterns ensures that your platform can scale smoothly to support millions of records and thousands of users without experiencing sharing calculations bottlenecks. Customise your architecture to prioritise these flat designs, and you will minimise the administrative overhead of managing the system.

Key Takeaways

  • The Role Hierarchy should be architected to enforce data visibility boundaries rather than mirroring the corporate org chart.
  • Role modifications trigger background group membership recalculations that lock sharing tables and can cause system timeouts.
  • Ownership skew (one user owning >10,000 records) must be avoided, especially for users placed high in the role hierarchy.
  • Keep the role hierarchy flat by standardising on broad roles and using Permission Sets or Public Groups for granular access.
  • Separate internal hierarchies from external portal hierarchies, and utilise Sharing Sets to bypass portal role generation completely.
  • Leverage Collaborative Forecasting and Enterprise Territory Management to satisfy complex reporting needs without expanding roles.

Checkpoint: Test Your Understanding

What is the primary technical issue triggered by moving a highly-populated role in a deep hierarchy?

A. Salesforce automatically logs out all active users assigned to that role
B. Extensive database recalculation locks sharing tables and may cause timeouts
C. The system automatically deletes all custom validation rules on the affected sObjects
D. The metadata API rejects any future packages containing that role name

To prevent performance locking during sharing recalculations, what is the best practice for integration user roles?

A. Assigning the integration user to the highest role in the executive hierarchy
B. Placing the integration user in a role at the absolute bottom of the tree, or assigning no role
C. Assigning the integration user to a new custom role for every integration service
D. Enabling 'Grant Access Using Hierarchies' on all integration objects

Which Salesforce feature allows you to model complex sales structures for reporting and access separate from the Role Hierarchy?

A. Enterprise Territory Management (ETM)
B. Custom Metadata Types and validation logic
C. Visualforce page action controllers
D. Object Sharing Rules using public groups

Discussion & Feedback