I'm facing this error :

OpportunityTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []: Class.OpportunityHandler.ManageSharingForRI: line 58, column 1

the line in question is :

if (lsOppShareToCreate.size() > 0)
                insert lsOppShareToCreate;

I search about that error and I found that it may be caused by the fact that my user is not allowed to insert an opportunity. I am right ?

Do you know how I can allow the users to do that ?

  • give them permission from their profile. Commented May 20, 2016 at 9:41

1 Answer 1


You are trying to insert Opportunity share record on this line.

This error might occur due to one of the following condition-

  1. If you are trying to share the Opportunity record with a User who already has permission on this record
  2. If you are trying to share record with a User who does not have access to Opportunity Object
  3. Or If the User sharing the record does not have permission on the record then this error occurs.

Hope this helps :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .