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
Rajasree JayarajRajasree Jayaraj 

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

We have an Account manager field under Account (lookup to user) and whenever an account manager is added/ updated, should add the same user to the Account Team object granting full access to Account/Opportunity/Contact (via Account share).

I have written the method to call on insert and update of Account, where I am inserting account team member & share record.On update, it removes the old user from Account Team and adds the new one. It works well for some users (profiles), but sometimes tend to throw exception-
first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

By default the share record takes OWD as default level access (which in my case is Account- Public read Only, all others Private)

Could you please suggest me how I can get over this exception and grant full access via share record. In short, the Account Manager (ie Account Team) should have full access to the three objects.

Many Thanks in advance!