Skip to main content

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.

#Experience Site  #Apex

 

 

#Community Licenses

2 respuestas
  1. 31 jul, 3:50

    Hello @Tushar Jadav

     

     

    Thanks for your suggestion. 

     

    The user's license is

    Customer Community Plus Login

     

    I tried your solution, but it doesn't work for my issue, I still get the same error. 

    What could be the issue?

0/9000