ApexINSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on crossreference 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:

https://salesforce.stackexchange.com/questions/106212/insufficient-access-on-cross-reference-entity-insufficient-access-rights-on-cro

- Advertisement -spot_img

More From UrbanEdge

Top Salesforce Flow Interview Questions & Answers 2024 Part – 3

Top Salesforce Flow Interview Questions & Answers 2024 Part...

Top Salesforce Flow Interview Questions & Answers 2024 Part – 2

This blog will explore some of the most commonly...

Best Practices for Lightning Web Components (LWC)

Lightning Web Components (LWC) is a modern framework by...

Top Salesforce Flow Interview Questions & Answers 2024 Part – 1

Flow Interview QuestionsWhat is Salesforce Flow?Types of Salesforce FlowsWhat...

Mastering Salesforce Flows: Streamline Your Business Processes with Ease

Understanding the benefits of using Salesforce FlowsKey components of...

Top Salesforce Static Code Analysis Tools: Enhancing Code Quality and Security

#Heading1Introduction2What is Salesforce?3The Importance of Code Analysis4Understanding Static Code...

Trigger Challenge #12: Understanding the Trigger on Account and its Impact on Salesforce Development

As a Salesforce developer, understanding how triggers work is...

Best Practices for Apex Triggers

Introduction Apex Triggers are a fundamental aspect of Salesforce development,...
- Advertisement -spot_img