Find your content:

Search form

You are here

Assign sharing reasons from Dynamically from APEX


Was wondering if there is way to assign the Sharing Reason aka Rowcause Dynamically. Well tried to implement using this "Schema.MyCustomObject__Share.rowCause.My_Sharing_Reason__c" but here I have to fix the sObject and the reason. Is there anyway to assign them dynamically?

Attribution to: Avidev9

Possible Suggestion/Solution #1

You can't assign them completely dynamically.

You need to create them from the point and click interface (Setup->Create->Object Name->Apex Sharing Reasons) or via the meta-data api.

myObject__share share = new myObject__share();

Attribution to: jordan.baucke
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content