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
Shriram Dubey 20Shriram Dubey 20 

common.apex.runtime.impl.DmlExecutionException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []"|0x3bc22537

Hi, Actually I am using the cloud Craze package and trying to insert cc cart Item for guest users. and I have given all the field permission and related object permission(account, cc cart, cc product). But I am getting the below error while inserting the cartItem in the Cart:-
common.apex.runtime. DmlExecutionException: Insert failed. First exception on row 0;INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []"|0x3bc22537
Can you pls suggest to me which NSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY I have to give permission to?
AbhishekAbhishek (Salesforce Developers) 
Hi,

Troubleshooting steps:
1. Make sure whether the user has access to record ids of the lookup fields and/or master-detail fields in the record.
2. Check the user Profile(CRUD Permissions).
3. Profile need to have access to the record types.
4. Record's OwnerId automatically gets a shared record when the record is inserted. If the apex code tries to create the same(Share record for the owner) explicitly. This error occurs. 
 
Sample Code for this error:
 
Id usrId = UserInfo.getUserId();
Account objAccount = new Account( Name = 'Testing', OwnerId = usrId );
insert objAccount;
AccountShare objAccountShare = new AccountShare();
objAccountShare.AccountAccessLevel = 'Edit';
objAccountShare.AccountId = objAccount.Id;
objAccountShare.RowCause = 'Manual';
objAccountShare.UserOrGroupId = usrId;
objAccountShare.OpportunityAccessLevel = 'Read';
insert objAccountShare;

5. Check whether the apex code is trying to create share records to the record which the current user doesn't have access to it.
 
6. Check whether there are any hard-coded ids are miss matching the environments.
 
Note:
Even though the trigger runs in System Mode, Sharing Settings will be checked. Only CRUD and FLS will not be checked against the user.


For further suggestions check this,

https://salesforce.stackexchange.com/questions/5546/how-to-fix-insufficient-access-rights-on-cross-reference-id


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.