Sub topic 9
Sharing a Single Record Manually
This chapter assumes you know org-wide defaults, record ownership, and the role hierarchy from earlier chapters. You should also be able to read basic SOQL.
What manual sharing is
Manual sharing lets a user grant access to one record to another user, a public group, a role, or a role and subordinates. It is the right tool for one-off exceptions. Sharing rules cover patterns that repeat.
Manual sharing only adds access. It never removes access that the org-wide default, the role hierarchy, or a sharing rule already gives.
Who can share and what they can grant
The Sharing button appears on a record's detail page only when both conditions hold:
- The org-wide default for the object is Private or Public Read Only. If the default is Public Read/Write, there is nothing to add, so the button is hidden.
- The user is allowed to share the record. That means the record owner, a user above the owner in the role hierarchy, or an administrator with the right permissions. A user with Full Access on the record can also share it.
A user can grant a level of access that does not exceed what the org-wide default allows, and not more than the access they hold themselves. The levels are Read Only and Read/Write. Some objects, such as accounts, also offer related-record access for contacts, opportunities, and cases.
Sharing a record step by step
- Open the record.
- Click Sharing.
- Click Add.
- Choose a type (Public Groups, Roles, Users, and so on) and pick the recipients.
- Set the access level and click Save.
The Sharing Detail page then lists each grant with the reason it exists.
When manual shares are removed
Manual shares are fragile. Salesforce deletes them when the record owner changes, because the share was granted on behalf of the old owner. They also disappear if the owner's access no longer qualifies. A manual share is also gone once someone deletes it from the Sharing Detail page.
How a manual share is stored
Each manual share is a row in the object's share table. For a custom object named Invoice__Share, the row has a RowCause of Manual. Query it like this:
SELECT Id, ParentId, UserOrGroupId, AccessLevel, RowCause
FROM Invoice__Share
WHERE ParentId = '<invoice record Id>'A later chapter covers share tables in full. For now, note that the Manual row cause is what tells you the grant came from the Sharing button, and not from a rule or the hierarchy.
Choosing manual sharing
| Situation | Manual sharing fits? |
|---|---|
| One record needs a temporary exception | Yes |
| Many records match a pattern | No, use a sharing rule |
| Owners change often | No, shares are deleted |
| Access must follow a customer relationship | No, use an account team |
Exercise
A sales manager shares an opportunity with a colleague using the Sharing button. A week later the opportunity is reassigned to a new owner, and the colleague loses access. Why, and what would be a more durable choice?
Show answer
Changing the record owner deletes the record's manual shares. A more durable choice is an opportunity team, which stays on the record, or a criteria-based or owner-based sharing rule if the access follows a pattern.