-1

I am getting INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY error when creating a case record.

There are lot of lookup fields in our case object, is there a way I can know what specific object is this error referring?

1 Answer 1

1

It's hard to say as no further information is shared in your question, you can guess using the error message if it shows the line number of code on which compiler throws the error.

This information may be helpful to you:-

When does INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY error happen?

This error normally happens when a DML operation is performed. Meaning that, whenever an Insert or Update is performed. You won't see this error when you save your APEX class or TRIGGER, because this error happens at RUNTIME.

What does this error mean?

This error means that you are trying to do an operation which is not supposed to be done, or the operation you are about to perform is not permitted according to the Sharing and Security settings defined. This error message does NOT always mean that you lack access to do the operation, even though it might be the case sometimes. So, even if you are an ADMINISTRATOR you may get this message.

Scenario 1: Creating a new record (Account/Contact/...) and setting the Owner. Applies to update records as well.

So, in your code, you create some records. By Default the creator of the record is the Owner. You want to change this and you modify the OwnerId column of the newly created records. You make "User X" as the Owner. Now when you run the code, you get the Error below:

Things to check:

  • Check that the running user (in this case you) has access to the object being operated. Check that he has the CREATE privileges on the object. This is optional but is always better to start from here.
  • Check that the Owner ie User X has the CREATE permission on the object. Check that his profile has the CREATE permission on the particular object. He might not be having it, grant him permission and the issue is resolved.

Scenario 2: Creating or Updating a Case(just for an example, might be any object). Setting the related Account of the Case.

So, let's say that you create 5 cases and you set the Owner to "User X". You set the Account to "Account X". When your code tries to insert these 5 Cases, it fails and you get the same error message.

Reason: This is because "User X" does not have access to "Account X". When you try to create a case for "Account X" that he does not have access to the code fails. Either grant access to "User X" for "Account X" manually or through the code and then do the Insert.

Reference:- http://www.forcetree.com/2011/12/insufficientaccessoncrossreferenceentit.html

You must log in to answer this question.

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