2

I am trying to understand how the self registration for customer portal works. I came across , https://developer.salesforce.com/page/Authenticating_Users_on_Force.com_Sites and http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_sites.htm which clearly explains the process except one thing.

When self registration is enabled, SiteRegisterController is created. this controller creates new portal user. As a part of this we need to pass the account id that will get associated with the Contact under portal user.

Code in the above links suggests that we can hard code the accountid. Does this mean all new portal users will have the same account ? How the account id is passed during self registration if users from Account A and Account B wants to register on the customer portal?

1

The sample SiteRegisterController includes a hard coded Account ID which is the simplest approach: people are self registering so you don't know anything about them and putting them all under one Account is the best you can do. (Using a custom setting for the ID would be a basic improvement.)

But if you do know something about the people registering:

  • perhaps you have a pre-created Contact record for them already with a field such as the Email address pre-populated that you can query
  • or perhaps you have some other data upload in your org to allow you to categorize the new users that you can query
  • or perhaps you prompt for some additional categorizing information in your SiteRegister page

then you can query for and provide the relevant Account ID in your SiteRegisterController logic.

| improve this answer | |
  • Thanks Keith. I was curious as to how this works in real production environments. It makes sense now. – apn Oct 15 '14 at 19:24

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.