function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PronowPronow 

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.
Ashish_SFDCAshish_SFDC
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.


Regards,
Ashish
PronowPronow
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.