function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Surendra PeramSurendra Peram 

error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

Hi Team,

I have a scenario like,
Agreement and Account Association objects. Agreement is a parent and Account Association is child. 
Account Association have a lookup field for Account (Standard object).

I am trying to copy the account association from one agreement to another agreement. trigger code sample is like,
Agreement__c agr1 = [Select id,(select id,account__c from AccountAssociations__r) from agreement where version__c = '0.1'];
Agreement__c agr2 = [Select id from agreement where version__c = '0.2'];
AccountAssociation__c aa = new AccountAssociation__c();
aa.agreement__c = agr2.id;
aa.Account__c = agr1.AccountAssociations__r[0].account__c;
System.debug('@@@@'+agr1.AccountAssociations__r[0].account__c);
insert aa;
while inserting the record i am getting below error
System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: 0011l000009pfDh:
In above error the mentioned ID is belongs to account object. I am testing this functionality for some sales user, he do not have read permission for that account record "0011l000009pfDh". Here i am not updating account but i am just updating account record id in AccountAssociation__c object.
Please suggest me the solutions. Thanks In advance

Khan AnasKhan Anas (Salesforce Developers) 
Hi Surendra,

Greetings to you!

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id:[] is a common issue when you try to update or create data with insufficient access on a record.

Kindly check the user profile and check whether the user has access to insert/update that record. Even if the user has access, kindly check whether the user has access to update fields like record types, lookup field, master-detail field, etc.

Troubleshooting steps: 
  • Make sure whether the user have access to record ids of the lookup fields and/or master-detail fields in the record.
  • Check the user Profile(CRUD Permissions).
  • Profile need to have access for the record types.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas