Activity › Forums › Salesforce® Discussions › Can we define apex sharing reason for standard object?
Tagged: Salesforce Apex, Salesforce Apex Class, Salesforce Apex Controller, Salesforce Apex Function, Salesforce Apex Trigger, Salesforce Objects, Standard Objects
-
Can we define apex sharing reason for standard object?
Posted by PRANAV on April 27, 2018 at 11:15 AMCan we define apex sharing reason for standard object?
Aman replied 8 years ago 3 Members · 2 Replies -
2 Replies
-
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.
- [adinserter block='9']
-
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:
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
Log In to reply.
