Record access
Organization-wide defaults, role hierarchy, sharing rules, manual sharing, teams, Apex managed sharing and restriction rules.
Two users have the same profile and the same permission sets, and one of them sees a record the other cannot. What decides that, and why does almost everything in this model only know how to add?
What this page decides and what the other one decides
Permissions decide whether an object or a field exists for a user; sharing decides which individual records they see. Object and field permissions are the business of the Object and field access page in this subcategory, and one does not replace the other: sharing respects object permissions, so sharing an account with somebody who has no Read on Account achieves nothing.
Every record is owned by a user or a queue, and the owner has full access. A queue distributes records among teams that share a workload: its members, and whoever is above them in the role hierarchy, see it in list views and can take ownership. There are queues for cases, contact requests, leads, orders, custom objects, service contracts and knowledge article versions.
The floor: organization-wide defaults
Organization-wide defaults (OWD) set the access a user has to records they do not own, object by object. Help is explicit: you take them down to the most restrictive level the business allows and the other tools open access selectively, because they only grant additional access and cannot restrict below the OWD. Changing them needs Manage Sharing.
| Level | What it means | Objects that ship with it |
|---|---|---|
| Controlled by Parent | A user can act on the record if they can perform the same action on the associated record | Contact, Asset |
| Private | Only the owner, and whoever is above their role in the hierarchy, view, edit and report | Activity, Service Contract |
| Public Read Only | Everybody views and reports; only the owner and their superiors edit | Opportunity, User |
| Public Read/Write | Everybody views, edits and reports on all records | Account, Contract, custom objects |
| Public Read/Write/Transfer | Everybody views, edits, transfers and reports; cases and leads only | Case, Lead |
| Public Full Access | Everybody views, edits, transfers, deletes and reports; campaigns only | Campaign |
The factory defaults are not uniform, and there are separate levels for calendars, price books and activities.
There is also an external OWD for external authenticated users, which can never be more permissive than the internal one. Guest users do not count as external: their OWD is Private and cannot be changed. How an Experience Cloud site user reaches their records, through sharing sets and share groups or partner roles, is explained in Sharing for Experience Cloud users.
Two dependencies matter before lowering a value. If the OWD for Account is Private, Opportunity and Case have to be Private too, and Contact either Private or Controlled by Parent. And a custom object cannot go from private to public if Apex code uses its sharing entries. Raising access takes effect immediately; lowering it, only after recalculation.
The role hierarchy
The role hierarchy opens access vertically: whoever holds a higher role reaches the records their subordinates own or have shared with them, whatever the OWD. It does not have to copy the org chart: each role represents a level of data.
The switch is called Grant Access Using Hierarchies and can only be turned off on custom objects. Turning it off removes the superiors’ automatic access, but does not affect anyone holding View All Records, Modify All Records, View All Data or Modify All Data.
The numbers, with their scope. In orgs created in Spring ’21 or later you can create up to 5,000 roles per org; in earlier ones, 500, which Salesforce Customer Support can raise. And a recommendation, not a cap: no single user should own more than 10,000 records of an object.
Sharing rules
A sharing rule extends access to users in public groups, roles or territories by making automatic exceptions to the OWD. A public group is a set of users that can contain users, other groups, or the users of a role or territory with or without their subordinates; it is not a permission set group, which bundles permission sets and not users.
Two fixed rules: they can never be stricter than the OWD, and to create them the OWD has to be Public Read Only or Private. If several give the same user different access, the most permissive one wins.
Help documents three types.
| Type | What it decides the audience by |
|---|---|
| Owner-based | The records owned by certain users |
| Criteria-based sharing | The field values on the record, not its owner; even so, the hierarchy still gives access to whoever is above |
| Guest user | A special case of the previous one and the only way to reach unauthenticated guest users; Help warns that it grants immediate and unlimited access to anyone |
The limit: up to 300 rules per object, of which at most 50 criteria-based or guest user rules. Criteria-based rules cannot use lookup fields, encrypted fields, formula fields or fields derived from other fields.
Manual sharing, teams and Apex
Manual sharing shares individual records with users, public groups and roles, for one-off exceptions. Only the owner, whoever is above them in the hierarchy if it grants access, whoever holds Modify All Records on the object, and an admin can create it. The point that breaks implementations: by default, when the record owner changes Salesforce deletes its manual shares, and there is an org-level setting, Keep manual shares when transferring records, to prevent that. Help recommends not going beyond 10,000 manual account shares per recipient.
Teams exist for accounts, opportunities and cases. The owner builds one per record, adds members and sets each member’s access level; on account teams, members also reach the associated contacts, opportunities and cases. If a member already had more access through their role or through a rule, they keep the higher one.
Apex managed sharing is the way out when neither rules nor manual sharing suffice: it shares custom objects in code. Two properties set it apart: only somebody holding Modify All Data can add or change that sharing, and the access is maintained when the record owner changes or is deactivated. Apex sharing reasons explain in the interface why each row exists: up to 10 per custom object.
The only thing that subtracts: restriction rules
A restriction rule does the opposite of everything above: the read access the user already had is reduced to the records that meet the criteria. Help compares it to filtering a list view, except that it is permanent. Scoping rules are confused with them: they do not restrict access, they only narrow what is seen by default, and the user can switch the set. Both are in Lightning Experience.
| Restriction rule | Scoping rule | |
|---|---|---|
| What it does | Permanently filters read access already granted | Narrows what is seen by default; does not touch access |
| Editions | Enterprise, Performance, Unlimited, Developer | Performance, Unlimited, Developer |
| Objects | Custom and external objects, contracts, events, tasks, time sheets and their entries; and quotes, per the general article | Custom objects, accounts, cases, contacts, events, leads, opportunities, tasks |
| Active per object | 2 in Enterprise and Developer; 5 in Performance and Unlimited | 2 in Developer; 5 in Performance and Unlimited |
| Where it shows | Links, list views, lookups, records, related lists, reports, search, SOQL (the Salesforce query language) and SOSL (its search language) | List views, reports and SOQL |
| Criteria limits | EQUALS operator only, no formulas; not applied to code executed in System Mode | Enabled and disabled query by query |
Restriction has one big leak: it does not reach anyone holding View All Records or View All Data, who still see every record; with Modify All Records or Modify All Data they also edit and delete them. For a given object and user only one restriction or scoping rule should apply: Salesforce does not validate that, and if two apply only one is observed.
Help does not agree with itself on which objects restriction reaches: the general article lists “quotes” and the considerations article repeats the list without them. Neither prints a release, so this page exposes both instead of picking one.
That the OWD is therefore the only decision that cannot be corrected afterwards by adding another feature on top is this page’s reading, not a Help sentence.
Example: the portfolios of a private bank
A private bank wants each manager to see only their own portfolio, directors to see their managers’ portfolios, and compliance not to see the investment banking accounts. The case is invented; the order of the steps is this page’s proposal, not Help’s.
- Lower the floor first. Account goes to Private, which forces Opportunity and Case to Private and Contact to Private or Controlled by Parent.
- Let the hierarchy do the vertical work. A director role above the manager role is enough for the director to see their managers’ accounts, with no rule at all.
- One rule for the cross-cutting case. For the product team to see accounts from several branches, create a public group and an owner-based rule, not manual shares record by record.
- Manual sharing only for the exception. The account of a manager on leave is shared by hand with whoever covers it, knowing that it will be deleted when the owner changes if the retention setting is off.
- Restrict what sharing cannot. A sharing rule is no use for compliance: a restriction rule is needed, and those users must be checked for View All Records and View All Data.
The example does not claim the restriction hides the records from everyone: step 5 exists because it does not.
Which tool when
The criterion below is this page’s reasoning: Help describes each feature, but publishes no decision tree comparing them.
| Situation | What to use |
|---|---|
| There is a record some user must not see | The OWD at Private; no other tool can restrict below it |
| A manager has to see their team’s records | The role hierarchy, with no rules |
| A stable group of users needs another group’s records | An owner-based sharing rule targeting a public group |
| Access depends on the value of a field on the record | A criteria-based sharing rule, if the field is neither formula nor encrypted |
| It is a one-record, one-time exception | Manual sharing, counting on it being deleted when the owner changes |
| Several people collaborate on one account, opportunity or case | A team, with the access level per member |
| Access has to survive an owner change, or the logic is complex | Apex managed sharing, with its sharing reason |
| Certain users must see only part of what they already have | A restriction rule, after reviewing who holds “View All” |
| The goal is only to reduce list view noise | A scoping rule: it restricts nothing |
Before production
- Set the OWD of every object before building anything on top, with its dependencies (see “The floor”).
- Decide whether Grant Access Using Hierarchies has to be turned off, which is only possible on custom objects (see “The role hierarchy”).
- Count the sharing rules per object against the caps of 300 and 50 (see “Sharing rules”).
- Decide whether to enable Keep manual shares when transferring records before anybody loses access (see “Manual sharing, teams and Apex”).
- Review who holds “View All” or “Modify All”, because restriction does not reach them (see “The only thing that subtracts”).
- Check that per object and user only one restriction or scoping rule applies (see “The only thing that subtracts”).
- Test with a real user of each role and confirm they have the object permission they need (see “What this page decides”).
Official sources
- Control Who Sees What — Salesforce Help (opens in a new tab)
- Set Up Record Access for Your Users — Salesforce Help (opens in a new tab)
- Sharing and Record Access Features — Salesforce Help (opens in a new tab)
- Organization-Wide Sharing Defaults — Salesforce Help (opens in a new tab)
- Set Your Internal Organization-Wide Sharing Defaults — Salesforce Help (opens in a new tab)
- Organization-Wide Default Access Settings — Salesforce Help (opens in a new tab)
- Default Organization-Wide Access Levels — Salesforce Help (opens in a new tab)
- External Organization-Wide Defaults Overview — Salesforce Help (opens in a new tab)
- Controlling Access Using the Role Hierarchy — Salesforce Help (opens in a new tab)
- Guidelines for Success with Roles — Salesforce Help (opens in a new tab)
- Public and Personal Groups — Salesforce Help (opens in a new tab)
- Set Up Queues — Salesforce Help (opens in a new tab)
- Sharing Rules — Salesforce Help (opens in a new tab)
- Sharing Rule Types — Salesforce Help (opens in a new tab)
- Create Criteria-Based Sharing Rules — Salesforce Help (opens in a new tab)
- Sharing Rule Considerations — Salesforce Help (opens in a new tab)
- Manual Sharing — Salesforce Help (opens in a new tab)
- Manual Sharing Considerations — Salesforce Help (opens in a new tab)
- Additional Features that Control Data Access — Salesforce Help (opens in a new tab)
- Collaborate on Accounts by Using Teams — Salesforce Help (opens in a new tab)
- Collaborate on Deals with Opportunity Teams — Salesforce Help (opens in a new tab)
- Case Teams — Salesforce Help (opens in a new tab)
- Create Apex Sharing Reasons — Salesforce Help (opens in a new tab)
- Restriction Rules — Salesforce Help (opens in a new tab)
- Restriction Rule Considerations — Salesforce Help (opens in a new tab)
- Scoping Rules — Salesforce Help (opens in a new tab)
- Scoping Rule Considerations — Salesforce Help (opens in a new tab)
- Sharing Considerations — Salesforce Help (opens in a new tab)