I'm facing an issue while creating a Contact from an Experience Cloud site using an Apex controller.
Current Scenario
- The logged-in user is an Experience Cloud Customer Community Plus Login user.
- The Contact is created through an LWC that calls an Apex method
- The Apex controller is declared as public
- The Contact is populated with all the required fields, including the AccountId of the logged-in user's Account.
Behavior Observed
1. If OwnerId is not assigned
- Salesforce automatically assigns the logged-in Experience Cloud user as the owner during the insert.
- Since the logged-in user is an external user, the insert fails because saying "portal users cannot own Contact records."
2. If OwnerId = UserInfo.getUserId()
- The same error occurs because the logged-in Experience Cloud user becomes the owner, which is not allowed.
3. If OwnerId is explicitly assigned to an internal Salesforce user
- The insert fails with: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
- This appears to indicate that the external Experience Cloud user is not permitted to assign ownership to another user.
#Community Licenses
2 个回答
Hello @Tushar Jadav
Thanks for your suggestion.
The user's license is
Customer Community Plus LoginI tried your solution, but it doesn't work for my issue, I still get the same error.
What could be the issue?