Wednesday, October 17, 2012

Salesforce error - INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY

This error was causing a lot of pain in a Salesforce integration that we have. It seems like a permissions issue on first look. But it's sort of misleading. Even a System Administrator can get this error.

So after researching a lot, this was what I found:

The error is throw when you try to insert/update something that logically cannot be inserted/updated.

Some examples:
  • You try to update a record that does not exist. Maybe the record was never there or it was deleted.
  • You try to update an object field that cannot be set explicitly. These fields can only be updated by the implicetly. eg: object owner, CreatedById, CreatedDate, LastActivityDate, LastModifiedById, LastModifiedDate. You cannot explicitly update these fields.
  • You are trying to give permission to someone but you yourself do not have permission for this.
  • If you are trying to share "Record X" with "User Y" and you yourself do not have access to "Record x", this error happens Or if the "User Y" already has access to it.
These are just a few reasons you can get the salesforce error INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY; I am sure there are others.

No comments: