+ Start a Discussion

Site.createPortalUser() returns null

Hello there,

I am using Site.createPortalUser(user, accountId, password); method to create a Customer Portal User. However, it returns null everytime. And I receive an email with error: 'The default new user profile is not assigned to the portal. Registration from General_Pages is not able to create portal users.' 

I am assigning ProfileId to user. Please help me through this.

Thanks in advance.
Hi , 

In order to call createportaluser function, caller should be inside a form with forceSSL=true. otherwise, userid will return null when u call createportaluser function.

Hi Ashish,

I am using AngularJS in my Visualforce Page and I am calling this method using Javascript remoting. Basically, this method returns null when any of mandatory fields are not set. Else, sometimes if owner id is not specified then also it returns null. 

But forceSSL=true is certanly wasn't the issue at my end.

Thanks for you responce anyways.