当前位置:网站首页>INSUFFICIENT_ ACCESS_ ON_ CROSS_ REFERENCE_ ENTITY APEX / SALESFORCE
INSUFFICIENT_ ACCESS_ ON_ CROSS_ REFERENCE_ ENTITY APEX / SALESFORCE
2022-07-27 18:42:00 【sf_ wilson】
*If you are trying to share "Record X" with "User Y" and "User Y" already has access to "Record X" this error happens.
Even though i understood what this means and have dealt with it earlier, this time this error message sucked my brain for one week. Finally, i got it sorted out and i hope this post helps someone understand and solve as well.
When does this error happen?
What does this error mean?
Scenario 1: Creating a new record (Account/Contact/...) and setting the Owner. Applies to updating records as well.
Scenario 2: Creating or Updating an Opportunity (just for an example, might be any object). Setting the related Account of the Opportunity.
Scenario 3: The Sharing Object.
Another noteworthy article :https://www.infallibletechie.com/2012/12/insufficient-access-rights-on-cross.htmlINSUFFICIENT_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. Even if the user has access, kindly check whether the user has access to update fields like record types, lookup field, master-detail field, etc.
Troubleshooting steps:1. Make sure whether the user have 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 for the record types.
4. Record's OwnerId automatically gets share record when the record is inserted. If the apex code try 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 trigger runs in System Mode, Sharing Settings will be checked. Only CRUD and FLS will not be checked against the user.
边栏推荐
- Wechat applet wechat payment overview
- [mit 6.s081] LEC 8: page faults notes
- 如何实现Word、PDF、TXT文件的全文内容检索?
- 输入框blur事件与click事件冲突问题
- 2021.7.18笔记 mysql数据类型
- Deep learning - paper reading: action structural graph convolution network as-gcn
- MySQL code database creation parking management system foreign key
- 2021.7.28笔记 事务
- MySQL learning Day1 DDL, DML, DQL basic query
- An analysis of CPU explosion of a smart logistics WCS system in.Net
猜你喜欢
随机推荐
[MIT 6.S081] Lab 10: mmap
[MIT 6.S081] Lab8: locks
Visual Studio Code安装教程(超详细)
Using Jieba and pyhanlp tools to extract keyword words and sentences
2021.8.7 note Servlet
2021.7.18 notes MySQL data type
20000 words + 30 pictures | what's the use of chatting about MySQL undo log, redo log and binlog?
[MIT 6.S081] Lab 10: mmap
JDBC learning day1:jdbc
「MySQL那些事」一文详解索引原理
[MIT 6.S081] Lab 11: networking
2021.7.22笔记 约束
Wechat applet obtains openid, sessionkey, unionid
微信小程序多文件上传
2021.8.1笔记 数据库设计
2021.7.30 note index
Pandas' to_ SQL function usage
MySQL basic statement
[MIT 6.S081] Lab 4: traps
[mit 6.s081] LEC 1: introduction and examples notes



![[mit 6.s081] LEC 1: introduction and examples notes](/img/5d/2fc4bde8eebbb22605d314b5292e05.png)
![[MIT 6.S081] Lab 10: mmap](/img/5d/a59a6f723518553b9232bc09991075.png)




