We are trying to update the contact owner of a new contact created via the customer community in the before trigger and receiving the following error.

insufficient access rights on cross-reference id

enter image description here

The same code works completely fine in the after trigger. The customer profile have read/write access to account and contact in the community sharing setting

enter image description here

  • Please edit your post to include the relevant code. Are you using a trigger handler pattern? Are you using with sharing or without sharing consistently? Commented Dec 27, 2019 at 15:27
  • @DavidCheng I tested the class with both with sharing and without sharing and it did not seem to impact the error. Commented Jan 10, 2020 at 9:44

3 Answers 3


I've done a lot of troubleshooting on this... this is what i did to solve all the errors:

Portal user cannot edit own account and cannot create new contacts (portal users cannot own partner accounts)


If you need to update OwnerId of contact with the same user for all the records, you can configure it in Community Preferences instead of trigger.

Follow these steps:

  • Go to All Communities
  • Select the Community you are working on
  • Click on Administration
  • Select Preferences
  • Under Record Ownership, set a Default Owner

After a lot of troubleshooting, we found out that the issue was with the community permission for users. Since the community user was not permitted to see other users, the trigger was unable to assign the case owner as the internal user(because before trigger checks all the permissions and FLS)

To resolve the issue, go to Setup > Sharing Setting and check the User visibility checkboxes.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .