Sub topic 6
What Sharing Rules Do and What They Cannot Do
This chapter assumes you know how org-wide defaults (OWD), record ownership, and the role hierarchy work. It also assumes you know what public groups and queues are. Here you learn what a sharing rule is, what it adds to access, and where it stops.
What a sharing rule does
A sharing rule is an automatic exception to your org-wide default. It grants additional access to a set of records for a set of users. Salesforce evaluates the rule and creates share rows for you, so nobody has to share records one at a time.
Every sharing rule has three parts:
- Which records: chosen by record owner (owner-based) or by field values (criteria-based).
- Who gets access: a public group, a role, or a role and subordinates. Some rules can also target a queue, depending on the object.
- What level: Read Only or Read/Write. Some objects offer extra levels, such as Private or Full Access on certain standard objects.
The next two chapters cover the two rule types in detail. This chapter covers the limits that apply to both.
What sharing rules cannot do
They only open access
A sharing rule can never take access away. If the OWD is Private, a rule can make records visible to more people. If the OWD is Public Read Only, a rule can upgrade some users to Read/Write. A rule cannot lower access below the OWD.
To restrict access, make the OWD more restrictive. Then add back only the access that is needed.
They cannot override object permissions
Record access and object access are separate layers. A sharing rule can give a user Read access to an invoice. If the user's profile and permission sets lack Read permission on the Invoice object, the user still cannot see it. Field-level security also still hides fields the user is not allowed to see.
They are not per-record
A rule applies to every record that matches its owner or criteria. For a single exception, such as one colleague who needs one record, use manual sharing instead.
They depend on the OWD
If the OWD is already Public Read/Write, a rule has nothing to add. Salesforce does not let you grant access that the baseline already gives.
They depend on data staying in scope
Criteria-based rules react to field values. If Status__c changes from Overdue to Paid, the record falls outside the criteria. The share row is removed after recalculation. Users who depended on it lose access.
They are not unlimited
Each object has a limit on the number of rules, and a rule's access works through share rows. Many overlapping rules make recalculation slower and access harder to explain. Prefer a few broad rules aimed at groups.
Rule or something else?
| Requirement | Better fit |
|---|---|
| All records of one team's members visible to another team | Owner-based sharing rule |
| All records matching a field value visible to a group | Criteria-based sharing rule |
| One record for one person | Manual sharing |
| Per-account collaborators with different roles | Account team |
| Remove access from someone | Tighten the OWD or change ownership |
How rules appear in data
Each rule produces share rows on a share object, for example Invoice__Share. These rows record who has access and why. The row cause for a rule-created share differs from Manual, so you can tell them apart when you query.
Exercise
A user is in the Finance_Managers public group. A criteria-based rule shares overdue invoices with that group at Read Only, but the user cannot open an overdue invoice. Name two causes outside the rule's definition itself.
Show answer
First, the user's profile or permission sets may lack Read permission on the Invoice object, since sharing rules do not override object permissions. Second, the record may not match the criteria yet, or the rule has not finished recalculating, so no share row exists for the group.