I am trying to create a new user on a button action from Contact screen to create a "High Volume Customer Portal" community user. This action will trigger a apex logic to create the user with required details with profile as "High Volume Customer Portal".

While inserting the user record facing below exception

An Apex error occurred: System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Checked all below possibilities mentioned in other related posts Creating High Volume Portal Users for unit tests , How to create a user for newly cloned High Volume Customer Portal profile? and see all the users and owners have required roles configured.

Is there any other reason to get this exception? If i change the profile in code to any "Salesforce Platform" licensed profiles, the user record is getting created without any exception.

Along with creating user from apex, tried below approach as well.

I have enabled the "Enable Customer User" button on contact record and tried creating a user, this leads to insufficient privilege exception, even though i am the owner of the contact and related account and holds System Admin profile.

"Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.