Activity Forums Salesforce® Discussions What is Apex Managed Sharing?

  • Avnish Yadav

    Member
    September 10, 2018 at 2:43 pm

    Hello,

    Apex managed sharing is maintained across record owner changes. Basically, if you want to share a record programmatically we use Apex Managed Sharing. For example, AccountShare is the sharing object for the Account object, ContactShare is the sharing object for the Contact object, and so on.

    Thanks.

  • Parul

    Member
    September 10, 2018 at 6:30 pm

    Hi

     

    Apex managed sharing allows developers to programmatically share custom objects. When you use Apex managed sharing to share the custom object, only users with the “Modify All Data” permission can add or change the sharing on the custom object’s record, and the sharing access is maintained across record owner changes.

    Apex Manager sharing can be enabled on the object that is having private and public read-only access.

    Note:

    1. Apex Managed Sharing can not be enabled on public read-write objects
    2. Each custom object is having its own sharing table with __share name if the object sharing is private or public read-only
    3. Apex sharing reasons and Apex managed sharing recalculation are only available for custom objects.
    4. Objects on the detail side of a master-detail relationship do not have an associated sharing object. The detail record’s access is determined by the master’s sharing object and the relationship’s sharing setting

     

    Thanks

  • chanchal kumar

    Member
    September 11, 2018 at 2:41 pm

    hello

    To create an Apex sharing reason:

    1. From the management settings for the custom object, click New in the Apex Sharing Reasons related list.
    2. Enter a label for the Apex sharing reason. The label displays in the Reason column when viewing the sharing for a record in the user interface. The label is also enabled for translation through the Translation Workbench.
    3. Enter a name for the Apex sharing reason. The name is used when referencing the reason in the API and Apex. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
    4. Click Save.
  • shariq

    Member
    September 15, 2018 at 11:16 am

    Hi,

    To add more -

    Apex managed sharing is maintained across record owner changes. Basically, if you want to share a record programmatically we use Apex Managed Sharing. For example, AccountShare is the sharing object for the Account object, ContactShare is the sharing object for the Contact object, and so on.

    Hope this helps.

  • Prachi

    Member
    September 20, 2018 at 5:25 am

    hi,

    Apex managed sharing allows developers to programmatically share custom objects. When you use Apex managed sharing to share the custom object, only users with the “Modify All Data” permission can add or change the sharing on the custom object’s record, and the sharing access is maintained across record owner changes.

    thanks.

Log In to reply.

Popular Salesforce Blogs