You need to sign in to do that
Don't have an account?
Register a user with creating a new account
With our site we would like to provide a registration process to new users in such way that a new account and an according contact is created each time a new user registers. As a result after the successful registration there should be a new contact that belongs to a new account and this contact is linked to a newly created user.
Is that possible and how can we achieve that?
The documentation we found http://wiki.developerforce.com/index.php/Authenticating_Users_on_Force.com_Sites just provides an example where all newly created users and contacts are tied to one account.
First you have to create a new account. Please be aware, that the account-owner has to belong to a role. Otherwise you will not be able to associate the new registered user to this account. So you can do something like the following (code snippet from the SiteRegisterController):
HTH
All Answers
If you have enabled the login for the sites, you just need to follow the steps as given below:
1. Create a page that will collect information required for your Account, contact and User e.g: Communitynickname,Account Name, contact name and Info, password etc
2. If user has filled out all the information, call the Site.CreatePortaluser method as:
String userId = Site.createPortalUser(user, Account.Id, Password);
3. Method will automatically create a new user,account and a contact associated with the Account and User
4. Now, you can get the contact info collected from pages you have created and update contact created in step 2 with same.
if(userId!=null)
{
Contact contact = getContact(user.contactId); // Retrieve the contact created by the CreatePortalUser method.
//Update your contact info in this contact
contact.email = DummyContact.email; //this will be a dummy contact where you have collected your data from pages
//Then update the contact
database.update(contact);
Hope this helps you a bit.
First you have to create a new account. Please be aware, that the account-owner has to belong to a role. Otherwise you will not be able to associate the new registered user to this account. So you can do something like the following (code snippet from the SiteRegisterController):
HTH
Thank you for the quick response , it brought us to the right track! :smileyhappy: