For the community self registration page if the user enters the detail, I want to check if the contact already exist on the basis of email entered by user. If it does, I want to create user for that existing contact. How can achieve this?

1 Answer 1


I just found the solution.I have Prepared the User record data using the Contact details.Then call theSite.createPortalUser(user, accountId, password, sendEmailConfirmation) method to create the user.It is working fine.

  • So You are just setting up contact Id on newly created user Like new User(ContactId = exisitngContact.Id); and the pass that user to createPortalUser method??
    – patryk
    Commented Feb 9, 2018 at 10:54
  • 1
    @pepper42 Yes, I have posted the sample code in the Salesforce developer community.You can find the sample code from the link developer.salesforce.com/forums/… Commented Feb 11, 2018 at 6:39

You must log in to answer this question.

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