+ Start a Discussion

password problem

currently I'm working on provisioning salesforce users using the Web Services API. I can create the User object just fine, but the email message with the temporary password is not being sent to the new user's email. So when I single sign on with the new user into Salesforce, it's expecting the user to type in the old password which didn't get emailed.

Also, is there any way to get around this temporary password emailing system that is set up now.

Thanks for any help,

If you want the email to be sent, set the EmailHeader on your user create calls.

I'm not sure what your last question is asking, do you want to send the email, or is there something different that you'd rather do.
What I meant by the last question was that is there any way to avoid the new user being prompted to change his password the first time he logs in. For example, I would rather have the user see his normal salesforce landing page the first time he logs in and not get prompted to change the password. In my case, the user doesn't even need to know his password because he'd be using the single sign on feature that my application has.

Thanks for the tip about the email header by the way.


Perhaps you might try calling setPassword() to mitigate that issue?
I already tried that but it kept giving me an invalid new password fault with a null error message. So I figured that it is required that the user receive the temporary password in an email and then change his password the first time he logs in for setPassword() to work. Or maybe I'm just using it incorrectly.

But anyway, I can't even get the email from salesforce. Here is my code:

try {
            EmailHeader emailHeader = new EmailHeader();
            binding.setHeader("urn:partner.soap.sforce.com", "EmailHeader", emailHeader);
            sr = binding.create(user);
        } catch (UnexpectedErrorFault ex) {
            System.out.println("An unexpected error has occurred." + ex.getMessage());

the user object itself is working because I can create users just fine.

Any blatant mistakes visible?


you need to set it to trigger User emails.

setPassword() should work fine. And have you looked at the delegated auth feature? that would mitigate any password management in salesforce.com all together.
Sweet I'm getting the email now. setPassword() also works but I still get the prompt to change the password in salesforce UI the first time a new user logs in to salesforce even if I use setPassword() to change the password. I want to avoid this because my application enables SSO to Salesforce and the whole point of that is that the user doesn't have to deal with passwords. Is there any other way to avoid this?

As for delegated authentication, I have to use SAML based SSO instead since it is more of a standard and therefore I can use similar code for other places. Seems to me that delegated authentication is unique to Salesforce. Also, my superiors emphasize SAML. So there you go.

Thanks for the help so far,

We also support SAML as well.
Actually, I've already implemented SSO into Salesforce with SAML. Just have to figure out how not to prompt a new user to change his password the first time he logs in.