I've created a flow in Salesforce to share record access with portal users when a record is created. I use a junction object to determine which users or contacts receive access. This works well when creating records within the Salesforce org, but when a record is created from the portal, the other portal users linked to the junction object don't receive access.
I’m using the Ticket Share object (API Name: ServiceAppointmentShare) for sharing records. However, when I try to create a record from the community portal, I encounter this error:
Error: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []
Any assistance would be greatly appreciated!
Hello @Abhishek Surve,
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:
- Make sure whether the user has access to record ids of the lookup fields and/or master-detail fields in the record.
- Check the user Profile(CRUD Permissions).
- Profiles need to have access to the record types.
- 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.
- Check whether the apex code is trying to create share records to the record in which the current user doesn't have access to it.
Note: Even though trigger runs in System Mode, Sharing Settings will be checked. Only CRUD and FLS will not be checked against the user.
https://help.salesforce.com/s/articleView?id=000385619&type=1