Group Membership and Locking
Konten ini belum tersedia dalam bahasa Anda.
Module 3 of 6 in the chapter Sharing at Scale, chapter 22 of Securing Salesforce: Sharing and Visibility. Each module stands on its own.
The question this module answers: Why does a change to one role or group sometimes take minutes, block other changes, or fail with a locking error, and how do you plan around it?
A simple change that isn’t
Section titled “A simple change that isn’t”Moving a user to a new role looks like editing one field. Salesforce describes what actually happens: “seemingly simple changes to groups and group membership can sometimes involve substantial recalculations of users’ access rights” (Group Membership Operations and Sharing Recalculation (opens in a new tab), Designing Record Access for Enterprise Scale, Salesforce Developers, checked 2026-11-26).
For one user moving to another branch of the hierarchy, Salesforce’s list includes (same page):
- adding or removing access to the user’s data for the people above the old and new roles;
- for every customer or partner account the user owns, moving that account’s roles under the new role and adjusting the implicit shares that go with them;
- recalculating every sharing rule whose source group includes the old or the new role, taking the user’s records out of one set of rules and into another.
Now scale that up. Moving a whole role means Salesforce “must do all of the work involved in moving a single user for all users in the role being moved and for all of those users’ data.” And changing the owner of a customer or partner account, “what looks like a simple data update,” means moving that account’s roles and “adjusting the sharing for all the data associated with the customer or partner account” (same page).
Chapter 8 module 4 walks through moving one user and one role. This module is about what happens while that work runs.
The lock
Section titled “The lock”While Salesforce changes who belongs to which role and group, it locks the tables that hold that information. In its words: “the sharing system locks the tables holding group membership information during updates to prevent incompatible simultaneous updates or timing issues, both of which could lead to inaccurate data about users’ access rights” (Group Membership Locking (opens in a new tab), Designing Record Access for Enterprise Scale, Salesforce Developers, checked 2026-11-26).
That’s the right choice. A wrong answer about who can see what is worse than a slow one. Most of the time “these locks are held only very briefly.” But “in some scenarios—such as a change in role triggering a sharing rule recalculation—locks can be held for a longer time,” and then something else trying to change a role or a group gets “could not acquire lock” or “Group membership operation already in progress,” and has to try again (same page).
Who sees it? Salesforce says it’s typically customers running “large-scale data loads or integrations with other internal systems that are making changes to role and group structure, user assignments to roles and groups, or both.” And when? “During periodic organizational realignment events, such as end-of-year or end-of-quarter processing” (same page). In other words, on exactly the days the business is least patient.
One more source of locks that surprises teams: deployments. You can hit locking errors “if you’re updating the role hierarchy or group membership while running other deployments that also update group membership information or have Apex tests that do so” (same page). A release on reorganization weekend is two lock holders in one window.
Granular locking: some things at once
Section titled “Granular locking: some things at once”Salesforce doesn’t make everything wait. “By default, granular locking is enabled, which allows some group maintenance operations to proceed simultaneously if there’s no hierarchical or other relationship between the roles or groups involved in the updates” (same page). Salesforce lists the advantages:
- “Groups that are in separate hierarchies can be manipulated concurrently.”
- “Public groups and roles that don’t include territories aren’t blocked by territory operations.”
- “Users can be added concurrently to territories and public groups.”
- “User provisioning can occur in parallel.”
- “Provisioning new external users in existing accounts occurs concurrently.”
And the limit, which is the one to remember: “certain operations, such as reparenting (moving roles within the role hierarchy), still block almost all other group updates” (same page). Moving a branch of the hierarchy is the one change that still stops nearly everything else.
So granular locking helps the steady, everyday traffic: new users arriving, people joining groups. It doesn’t help the big reorganization much, because that’s mostly reparenting. As the Data Architect course puts it, granular locking helps, but it isn’t a cure (Volume Meets the Sharing Model).
Plan around it
Section titled “Plan around it”Salesforce gives three habits for avoiding lock conflicts (Group Membership Locking):
- Schedule “separate group maintenance processes carefully so they don’t overlap.”
- Retry. Implement “retry logic in integrations and other automated group maintenance processes to recover from a failure to acquire a lock.”
- Go serial “if using parallel processing leads to locking errors.”
And add one of my own: keep deployments and reorganizations apart. If a release has Apex tests that touch groups or roles, it doesn’t share a window with a realignment.
Put together, a big role or group change is an operation with a plan, not an edit someone makes on a Tuesday afternoon. That’s the same discipline the Data Architect course asks for: a large security realignment deserves the same care as a large data migration. Module 4 covers what recalculates, and module 5 puts it all into a realignment plan.
Test knowledge. Know that moving a user or a role recalculates access to that user’s data up the hierarchy, adjusts customer and partner account roles, and recalculates sharing rules whose source group includes the old or new role; that Salesforce locks the group membership tables during these updates, which can cause “could not acquire lock” errors during large loads, integrations, realignments and deployments; that granular locking, on by default, lets unrelated group operations run at the same time, while reparenting roles still blocks almost all others; and the habits: schedule, retry, go serial. This supports IMP-1, the scalability implications of the sharing solution. A likely area, not a known question.
What an architect decides here
Section titled “What an architect decides here”- Which processes change roles, groups and territories, and when each one runs, so they don’t overlap.
- Retry logic in every integration that changes users’ roles or groups.
- Whether bulk group maintenance runs in parallel or serial.
- That role reparenting is planned as its own operation, in its own window.
- That deployments with tests touching groups and roles stay out of reorganization windows.
Beyond the exam: what AI changes. An agent asked to “move these 40 reps to the new region” makes 40 role changes, as fast as it can, each one a lock. Run that kind of request through the same plan as any other realignment, not as a chat message.
Explore
Section titled “Explore”- Group Membership Operations and Sharing Recalculation (opens in a new tab), Designing Record Access for Enterprise Scale, Salesforce Developers (checked 2026-11-26)
- Group Membership Locking (opens in a new tab), Designing Record Access for Enterprise Scale, Salesforce Developers (checked 2026-11-26)
- When People Move, chapter 8 module 4
