You need to sign in to do that
Don't have an account?
Apex Managed Sharing Error: Invalid share row cause
I'm trying to setup a Sharing Reason and I'm having some issues.
Here are the steps and conditions I'm working with.
1. I'm working in the sandbox.
2. I have a custom object with a default sharing setting of "Private"
3. On my custom object, I created an Apex Sharing Reason. I created it by going to Setup > Create > Objects > My_Object__c and then adding a new Apex Sharing Reason
Now, I'm getting an "invalid share row cause" when I try the following in a Trigger
Candidate__Share managementShare = new Candidate__Share(); managementShare.ParentId = can.Id; managementShare.UserOrGroupId = managementGroup.Id; managementShare.AccessLevel = 'edit'; managementShare.RowCause = Schema.Candidate__Share.rowCause.Employee_Sharing_Reason;
What am I doing wrong? If I change the RowCause to:
Schema.Candidate__Share.RowCause.Owner
The error is gone but I'm not getting the share I want.
I think you are missing the __c at the end of your reason:
From the Apex docu:
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_bulk_sharing_creating_with_apex.htm?SearchType=Stem
All Apex sharing reason names have the following format:
+1