I am inserting a manual share record for a custom object (Request__c) and getting the error: "Insert failed... insufficient access rights on cross-reference id: []"
.
When I comment out the insertion of the Request__share record the error does not occur so I know it's specific to that insert. The class is running without sharing. The user performing the action has access to the relevant record type on the Request__c object. I debugged all the variables being used to create
Any ideas what might be causing the insert to fail? I feel like it may be security related, but I'm not sure how to check what permissions are needed to insert a Request__share
record. It's running without sharing so I'm not sure what the issue could be.
Relevant code:
sharingToCreate.add(new Request__Share(
AccessLevel = 'Read',
RowCause = 'Manual',
ParentId = requestId,
UserOrGroupId = piwi.ActorId
));
insert sharingToCreate;
default external access
for this user from Sharing settings?without sharing
? Thanks!