I am trying to build a database.com app, and goal is to user Database.com light users ($10/100). I want to give a signup screen for new users. Regarding this I checked available API options

Problem with both the above calls is that, I don't see an option to set the password for the new user. My app will use database.com behind the scenes, so sending salesforce password reset emails will not be acceptable at all.

On some research I found an option in SOAP API i.e. setPassword() call. Again problem is that during signup assuring success of both operations it tough i.e. - Create Call - Set Password call

Is their any direct API available which can be used to create users with desired username/password in force.com or database.com ?

  • Does it help if the users are precreated and all tht happens when the user registers update details and email on a dummy user, and use setPassword. Apologies if that makes no sense. Just thinking aloud. Commented Nov 5, 2012 at 9:19
  • @techtrekker - this will probably still send the "confirm change of the email address" message? :/ I don't think we can use dmloptions to suppress these.
    – eyescream
    Commented Nov 5, 2012 at 10:03
  • The @eyescream solution below solves the sending email problem, what will solve my problem is exposing an Apex REST web service that will create both User and call System.setPassword in one go. This will be more atomic and controlled, still open for any better approach, as I want this one to be last choice. Commented Nov 5, 2012 at 10:04
  • Found this REST resource, which is pretty helpful in my usecase : docs.database.com/dbcom/en-us/db_rest_api/… Commented Nov 8, 2012 at 10:29

1 Answer 1


You can suppress creation of initial email (it's identical to unticking the checkbox "generate new password and notify user immediately" on the new user screen). Then whenever you're ready later - System.setPassword?

If this can work for you I'd like to link to my SO answer for similar thing: https://stackoverflow.com/questions/13118039/salesforce-creating-contact-and-user-by-importing-csv-file-send-notification/13137400

The problem with setPassword is that it's good for one time (upon logging in you land on the password change page similar to what happens when your password expires). That's how SF makes sure sysadmin will not know the user's final desired password. And of course you'd have to set it to something that complies with your own policies ("remember 3 last passwords" for example).

  • (+1) Thanks @eyescream, System.setPassword() will work out if I expose an Apex rest webservice to take all the request data and create the user for me. Still this is not very pleasing way to provision user via API :( Commented Nov 5, 2012 at 8:51
  • how about this one @AbhinavGupta? System.ResetPassword(Id UserId,Boolean SendEmail) Not sure if this will work in api though
    – Sathya
    Commented Nov 5, 2012 at 13:09
  • I think using DMLOptions as indicated in the post shared by @eyescream works out good for me. here is the code sample List<User> users = new List<User>(); // fill in with data from your CSV Database.DMLOptions dlo = new Database.DMLOptions(); dlo.EmailHeader.triggerUserEmail = true; database.insert(users, dlo); Commented Nov 5, 2012 at 17:13

You must log in to answer this question.

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