2

While creating new users from Salesforce UI, we have a checkbox right at the bottom called Generate new password and notify user immediately. This is set to true by default and sends Welcome To Salesforce kind of an email to the newly created user. This email also contains a verification and password reset link.

I have hundreds of users to load in my production environment. Obviously, I would go for data loader to load all the users. However, there is no way to set this checkbox to true through the data loader. Basically, there is no field that could be accessed through the API. One workaround would be to load the data at once, then multi-select all the newly created users and hit Reset Password button on the users' list view. But this only sends a raw password reset email instead of a pretty Welcome to Salesforce email, and I want such an email to be sent across the users.

There is a very useful app on AppExchange called Clone This User, but that too involves a lot of manual work.

So, any idea/suggestions on how to load hundreds of users in bulk and also send them the Welcome to Salesforce email?

3

You can create an utility which will use system.setpassword for your group of users. If you dont want to do it using a utility class you can do it through trigger. Trigger is preffered if it is repeatable job. For onetime job utility class is good approach.

System.setpassword(userid,password); Then send and email from apex to the user with that password. You can use email template if you want

  • I agree. But this email template would be a custom one. There is no way I can trigger the standard email that Salesforce sends after user creation? – Sohan Shirodkar Jun 5 '18 at 5:35
3

By default, you cannot trigger the same email as Salesforce triggers in the scenario you mentioned. I have had a similar situation, which was resolved with coordination between IT and Business as we were not able to trigger the standard email. The approach that was taken was:

  1. Load All Users using data loader
  2. Set their password (to a common password) with a utility written using setPassword() API
  3. Send out a custom welcome email with guidance on their User Credentials along with any custom message that you want to include

However you should also review that because everyone's password initially set can be same, share the credentials in an appropriate manner. Or you can have the utility written in such a way that it generates unique passwords and triggers email along with.

1

If you have a developer handy, you could clone the data loader, and then patch it so it has a new feature to send the email you're looking for. Technically, it shouldn't take a competent developer perhaps an hour or so to hack this feature in to the Data Loader, but I'm not well-versed in what would be involved, so I can't say that with any certainty. Otherwise, no matter what you do, you're going to have to either find another solution (most of them are not free, sadly), or you'd have to write your own code.

The API option you're looking for is the EmailHeader, which you cannot set in the Data Loader; this is the reason why you'd need to have a developer create an alternative solution, or find a solution that does what you're looking for. I'm not an admin, so I don't know many of the AppExchange apps very well, but I suspect there must be something out there that can do 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.