• marty_bgi
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi All,

 

I am trying to get visitors of a site to self-register as members using the customer portal. This is something I have done a few times now, but in this case is not working.

 

The logic I during self registration is as follows:

 

- create a user, user

- create an account of type person account

- insert the account

- change the account owner to a system admin with a role assigned

- update the account

- get the accountId

- make the following call --> ID userId = Site.createPortalUser(u, accountId, password);

 

The above call return userId=null, so that the customer portal user is not created.

 

I have tried to do "manually"what  the Site.createPortalUser call does internally and it works. What I have done is as follows:

 

- create a user, user

- create an account of type person account

- insert the account

- change the account owner to a system admin with a role assigned

- update the account

- get the accountId

- get the PersonContactId (since this is a Person Account)

- assiign  user.ContactId = PersonContactId

- assing user.profileId = (Id of the customer portal user profile)

- insert user

 

This gets me a valid userId and the person account is created and enabled for the customer portal okay.

 

On that basis I have tried again the call to  Site.createPortalUser but instead of the accountId tried passing the PersonContactId (since it is a person account) and this did not work.

 

Any ideas would be very much appreciated.

 

Thanks in advance