Activity Forums Salesforce® Discussions Can we define apex sharing reason for standard object?

  • PRANAV

    Member
    April 27, 2018 at 11:15 am

    Can we define apex sharing reason for standard object?

  • Manpreet

    Member
    April 27, 2018 at 11:16 am

    Hi pranav,

    No. We can define apex sharing reasons for custom object.
    Apex sharing reasons are defined object by object. - so, positions might have different reasons than candidates.

    Thanks.

  • Aman

    Member
    May 1, 2018 at 7:53 am

    Hi Pranav,

    Since we have defined Apex Sharing Reason on Custom Object sharing, it will keep Share table records updated whenever record owner is changed.  So, still granted user can access the records without any issue. This scenario is totally different for standard object because Standard objects don’t support Apex Sharing Reason. So, while sharing standard object records, by default you must define RowCause is “Manual”.

    It will impact the sharing table when record owner is changed. To solve this issue, we need to call apex sharing logic for both Insert as well as update function.

    Example Apex Sharing Code for Standard Objects: 

    download (2)

    Record Sharing via Workflow Rule.

    When you are sharing records to external system via Outbound Message, you should add condition like “OwnerId <> PriorValue(OwnerId)”. So, whenever record owner is going to change, it will share the records to external system again.

    Thanks

Viewing 1 - 3 of 3 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos