3

While I am creating a Community User through an apex call to SiteSite.createExternalUser(u, accountId, password), the method is returning null.

Can anyone help me out?

2
  • 1
    Yes, it really sucks that Site.createExternalUser's only communication concerning failure or success, is its return value: null or not null. So many things can go wrong, but it does not give any clues what went wrong. The log is also empty. It's a black box! Does the owner of the account have a role? It is required. Is the required nick name unique? Commented Nov 30, 2015 at 15:54
  • 1
    I ended up replacing the call to createExternalUser with inserts of an Account and a User record, as well as associating the two of them by filling the User ContactId field. I hope that is all the required functionality. It looks good, so far, because I can navigate between the newly created Account and User records. Commented Dec 1, 2015 at 13:32

1 Answer 1

1

This means that it had some kind of problem creating the user.

  • Check that all of your user fields are valid.
  • Check that the owner of the account is valid (and has the right permissions).
  • Check that the password you set for the user follows the rules. You can check your org's password policies in Setup.

It's probably the last one, since insert user doesn't require a password, so if that works then that's the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .