1

Very strange case in which these calls:

id finalUserId = Site.createPortalUser(user,accountid,password,true);
if(finalUserId != null){    
    return Site.login(tu.email, password, 'PORTAL_Home?newuser=1');
}

Work perfectly in my dev environment but fail in production with an invalid password response, does anyone know in what situation this is able to fail?

We do have a lot of users and a very large role hierarchy possibly a race condition between user creation and registration?

1

I think your race theory is correct.

In the site class docs, they call CreatePortalUser, check to see that it returns the if if the new user, and then call login.

Besides avoiding the race conditions, you might also be abject to return the exception (if there is one) on user creation. Typically for us that's been passwords that aren't allowed , or duplicate username / nickname issues.

  • Yes I am checking for the userid being returned and it's there quite happily, the user is created, it's just seemingly not respecting and setting the passed password parameter. – Baxter Dec 4 '13 at 11:11
  • Can you post the actual code, then? The snippet in the original post didn't have the id check and that makes it harder to be helpful. – Shane McLaughlin Dec 4 '13 at 14:00
  • Understood my view was that the id check was noise in the face of the user always being created and the standard functionality seemingly violating it's contracts. – Baxter Dec 4 '13 at 16:42
  • What about: PageReference pr = site.login(...); system.debug(pr); return pr; then you can at least see what's coming back in the debug log. – Shane McLaughlin Dec 5 '13 at 2:00
  • Another option would be to requery the user by that id, use it's username directly out of the DB. – Shane McLaughlin Dec 5 '13 at 2:04
1

After digging through the debug files on user registration and a call to BMC it turns out that remedyforce has a default on option that automatically fires a password reset in a trigger for all new users, totally disregarding any options set through standard ui or the api.

Still quite miffed over this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.