Contents
Apex sharing reason
- Click “Setup | Create | Objects”.
- Select the custom object. (In this case, the “Test” Custom object.)
- Click New in the Apex Sharing Reasons related list.
- Enter a label for the Apex sharing reason.
- Enter a name for the Apex sharing reason.
- Click Save.
Salesforce Manual Sharing allows the users to share the record to users who would not have access to the record any other way. Only these 4 users can share the record: Record Owner. A user in a role above the owner in the role hierarchy.
What do you need to know about shared Records in apex?
Apex managed sharing must use an Apex sharing reason. Apex sharing reasons are a way for developers to track why they shared a record with a user or group of users. Using multiple Apex sharing reasons simplifies the coding required to make updates and deletions of sharing records.
When to use apex managed sharing in Salesforce?
Apex Managed Sharing is used to share the records when you can not use Sharing rules. We do insert the Share Record using Apex trigger/class. In the video, I was showing when the Share Object will be available or not. So if the Object Have Any active Rule then Share Object will always be available no matter what OWD is.
When to use apex managed sharing in Owd?
Apex Managed Sharing only works when the OWD is either private or Public Read Only. Apex Managed Sharing is used to share the records when you can not use Sharing rules. We do insert the Share Record using Apex trigger/class. In the video, I was showing when the Share Object will be available or not.
For more information, see “Custom Object Security” in the Salesforce online help. A share object includes records supporting all three types of sharing: managed sharing, user managed sharing, and Apex managed sharing. Sharing granted to users implicitly through organization-wide defaults, the role hierarchy,…
https://www.youtube.com/watch?v=B8PCUpZSeT8