Manual sharing
Manual sharing is the ability for a record’s owner to give access to that record (and also other related records) to other users who are not necessarily included in their hierarchy. If you give another user access to an account record, that user would be able to access cases and opportunities.
At the time of writing, this feature is only available in Salesforce Classic (you can take a look at this at https://success.salesforce.com/ideaView?id=0873A000000LmluQAC).
To manually share a record, you must either be its owner, a user above the owner’s hierarchy (if Grant Access Using Hierarchies is enabled for that object), any user with full access, or a system administrator.
The Sharing button can be displayed on a record page if its OWD is set to Private or Public Read-Only.
In the following screenshot, we can see that the account has a Public Read Only OWD:
By clicking the Add button, you can set up manual sharing for the record:
In the Search field, you can include the following information (depending on the features in your organization):
- Manager groups: All the user’s managers
- Manager subordinates groups: All the user’s managers and their subordinates
- Public groups: Groups defined by the administrators
- Personal groups: Groups defined by the current owner
- Users: All internal users
- Roles: All the roles in your organization
- Roles and subordinates: All the roles in your organization (not available if portals are enabled)
- Roles and internal subordinates: All the roles in your organization and all the users below that role hierarchy (no portal roles considered)
- Roles and internal and portal subordinates: Like the previous point, but with portal roles and users
- Territories: All the territories defined in your organization (if territory management is enabled)
- Territories and subordinates: All the territories with the users below the territory hierarchy
We can use the Find button to search for entities to share the record with. Once we have found them, we can move them into the Share With select list. Then, we can select the required access level (Full Access, Read/Write, or Read-Only).
Once saved, this is what you will see on the record’s Sharing Detail page:
You can’t share a record with another user unless they have read permission on the given object, and you can’t share a record if the owner is an inactive user.
Apex managed sharing
When the sharing options aren’t enough, or you simply need to share a given record automatically with a user or a group without changing its ownership, you can go with Apex managed sharing.
This kind of sharing is close to manual sharing but it is best used with Apex automation or external API calls (that is, the other system’s operations directly into Salesforce).
To change an Apex managed sharing record, you need to have a Modify All Data permission: that’s why this custom sharing is maintained even if the record changes ownership.
How to create Apex managed sharing rules is out of the scope of this book, and you need developers to achieve this kind of custom sharing. However, you may have to consider it when sharing policies are highly complex or the other sharing methods don’t deliver the required level of sharing granularity.