For the self-registration page in our customer community, we'd like to be able to do the following:

  1. With the provided First Name and Last Name, match that with an existing Contact in Salesforce. If not in Salesforce, create a new contact (which I think Salesforce does this portion anyway).

  2. Have a zip code field for the customer to enter their zip code.

  3. Have another field called "Account Name" that displays accounts based on the zip code provided above.

Does anyone know if this is possible? I tried via conventional methods but it doesn't look like the User object can link to the Account object.

Thank you!

2 Answers 2


The self-registration creates a User object and if the Contact doesn't already exist creates that as well. The relationships are:

  • a User.ContactId field that links the User to the Contact
  • a Contact.AccountId field that links the Contact to the Account

When you have figured out which Account, you pass its Id into the Site. createExternalUser.

For the case where the Contact does not exist, I think this will work with the Contact tied to the right Account. I suspect if the Contact already exists, it won't be moved so you would have to do that yourself; not sure if you will be able to though.

Also in my experience, the matching to an existing Contact is done via a User.Email to Contact.Email field match when the Site. createExternalUser call is made so consider that in the logic too.


We actually had to use Apex to then create a custom component for self-registration to meet our needs above.

You must log in to answer this question.

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