We have person accounts in our org. to whom we need to give access to our customer community at various stages of an opportunity.

Is there a way we can programmatically enable our person accounts as customer users using apex ?

We have Customer Community Login licenses available in our org.


You can create Customer Community User programmatically using apex by assigning Customer Community Profile and set ContactId of the user to account.PersonContactId;

 newUser.ContactId = account.PersonContactId ;

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.