You need to sign in to do that
Don't have an account?
createpersonaccountportaluser
Hi. I'm trying to create a portal user in a force.com site but I can't seem to get a userId returned from site.createpersonaccountportaluser. No matter what I do nothing comes back. obnoxious. Has anyone else had this problem and/or solved it?
Here's the code where it's called. Student is a contact that was just created.
pUser = new User();
pUser.FirstName = student.firstName;
pUser.lastName = student.lastName;
pUser.Username = student.Email;
pUser.Email = student.Email;
pUser.CommunityNickname = student.firstName.left(1) + student.LastName;
pUser.Alias = student.firstName.left(1) + student.LastName.left(4);
pUser.emailencodingkey='UTF-8';
pUser.languagelocalekey='en_US';
String ownerId = site.getAdminId();
for(integer i=0; i < 10; i++){
userId = Site.createPersonAccountPortalUser(pUser, ownerId, currRecType, pwSelect);
if(userId != null)break;
}