INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross–reference id:[] is a common issue when you try to update or create data with insufficient access on a record. Kindly check the user profile and check whether the user has access to insert/update that record
You can use userRecordAccess
object to check CRUD
permissions..
So pass the recordId and userId.. to check that user having what type of access on that record..
you can check variables like HasDeleteAccess
. If HasDeleteAccess
true means user have delete access. If false then user don’t have access..
Based on these accessibility perform DML..
List<UserRecordAccess> lstUserRecordAccess = [SELECT RecordId,MaxAccessLevel,HasAllAccess,
HasDeleteAccess,
HasEditAccess,
HasReadAccess,
HasTransferAccess
FROM UserRecordAccess
WHERE UserId = '0036A00000uj2NY'
AND RecordId = '0013u000017yqjK'];
Reference: