Error: Insufficient access on cross reference entity.

A user might receive this error in the following situations:

1. Refreshing the Metadata Cache when committing files in a User Story.
2. Refreshing the Metadata Cache in an Org credential.
3. Committing files in a User Story.

This will happen when the user doesn't own the Org Credential that is being used and he/she doesn't have Write access on it. Note that Edit permission in the Org Credential object is not enough if the user is not the owner of the Org Credential record.

The object Org Credentials is set as private in the Sharing Settings what means that only the owner of the record can View and Edit it, this is standard Salesforce functionality. Git Snapshot for example, is a child object of Org Credentials therefore the access to these records will depend on the parent. A user working with Copado will require at some point View and Edit access to a specific Org credentials in order to get access to its child records. 

If the users don't have their own org credentials in the org, you need to make sure they have Write access to the Org Credentials they are using via:
  • The Share button in the Org Credential record.
  • Sharing rules for the Org Credential object.
  • Modify All permission for the Org Credential object in the profile or a permission set.
You may have noticed that some users are not affected by this issue even though they are not the owners of the org credentials. That is probably because the user has the Modify All Data permission on the profile or the Org Credential record has been shared with him/her.

How did we do?