Activity Forums Salesforce® Discussions What is Apex Managed Sharing in salesforce?

  • Patrick

    Member
    August 28, 2018 at 3:46 pm

    Short answer = programatic sharing driven by business needs. Dynamic sharing needs is the top use case.

    This is not uncommon, but is not the norm. You should try and stay away from it if you can to control technical debt. Most times, you can re-address the security strategy and get where you want to be without going to this level. It takes a developer to do this.

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_recalc.htm

  • Anjali

    Member
    September 18, 2018 at 1:41 pm

    Hi Chanchal,

     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.

  • Anurag

    Member
    September 18, 2018 at 2:24 pm

    Hi,

    Salesforce allows you to control access to data at many different levels i.e. object-level, the record-level and the field-level. Here we will focus on methods for controlling access to data at the record-level. In the most of the scenario you can use Out-of-box sharing settings to grant record access, but there are few use cases where  you have to write an Apex Managed Sharing to share the records with users or groups. Apex ManagedSharing allows you to use Apex Code to build sophisticated and dynamic sharing settings that aren’t otherwise possible. In this article I will show you how can use Flow and Process Builder to solve these requirements instead of using Apex code.

  • Patrick

    Member
    September 18, 2018 at 3:34 pm
  • Parul

    Member
    September 18, 2018 at 6:05 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

Log In to reply.

Popular Salesforce Blogs