Insufficient_access_on_cross_reference_entity - How can I resolve this error?

303    Asked by Amitraj in Salesforce , Asked on Oct 6, 2022

 I have a custom object Resource__c having master detail with Account object. I have Account1 created by User1 and if User2 goes to create resource on Account1 then below error is given :"INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []".


How can we handle this error before inserting or upserting in our Apex class or do exception handling for this error.

Answered by Amit raj

insufficient_access_on_cross_reference_entity - To resolve this error, you can check accessible rights on any object by describing it as below:


Schema.DescribeSObjectResult accountDescribe = Account.sObjectType.getDescribe();
System.debug('accessible:' + accountDescribe.accessible);

If it is not accessible then, you can show a proper message to the user.


Your Answer

Interviews

Parent Categories