Sample Scenarios
The following scenarios use simplified tables to illustrate how Salesforce recalculates the Object Sharing and Group Maintenance tables according to various record access changes, and uses those calculations to determine record access. Yellow highlights indicate data that grants access to the sample account record.
The scenarios only show data that’s essential to the example; they don’t show all of the fields and tables Salesforce uses for calculating record access.
Note
In these scenarios, the organization-wide default settings are Private for all objects, and the role hierarchy and users are as follows.

Salesforce generates the following groups to support the record access inheritance the role hierarchy establishes.

Scenario 1
Maria creates an account record (A1) for Acme. Under the hood, Salesforce creates a new account record for Acme and an owner sharing row for Maria in the Account Sharing table. Marc, because he is above Maria in the role hierarchy and an indirect member of Maria’s Sales Executive role group, inherits access.

Scenario 2
Maria manually shares the Acme account record with Bob. Under the hood, Salesforce creates a sharing row in the Account Sharing table for Bob. Both Maria and Marc have access to the record, because they are above Bob in the role hierarchy and indirect members of Bob’s East Sales Rep role group.
For manual record sharing, programmatic record sharing, and team sharing, the Object Sharing table creates rows the same way but with different row causes.

Scenario 3
An administrator creates a sharing rule that shares the Sales Executive’s records with the users in the Services Executive role and their subordinates. Under the hood, Salesforce creates a sharing row in the Account Sharing table for the Services Exec RoleAndSubordinates group, giving Frank and Sam access to the Acme record.

Scenario 4
Maria changes the owner of the Acme record to Wendy. When a record owner changes, Salesforce deletes its associated sharing rows with Manual row causes, so Bob loses access to the record. Also, because Maria, the Sales Executive, no longer owns the record, the rule from Scenario 3 no longer applies. Under the hood, Salesforce deletes the sharing row for the Services Exec RoleAndSubordinates group from Scenario 3, causing Frank and Sam to lose access to the Acme record. Salesforce also replaces Maria’s name with Wendy’s in the Account Sharing table.
The red ovals in this diagram indicate the many fields this seemingly minor change affects.
