A Salesforce Password Reset Trick

Jul 09, 2022

Happy Saturday!

 

Today’s issue is a quick tip for password resets. You can read it in less than 3 minutes.

 

Have you ever wanted to quickly set a Salesforce user’s password for them (without leaving Salesforce)?

 

I have. A few scenarios where this has come up for me are:

 

  • Training - Creating “training users” and setting passwords before employees arrive for training day
  • Quick Fix - Temporary access for a user who claims the reset password email didn’t work, didn’t send, or otherwise didn’t solve their problem
  • Sandbox - Setting a user’s password when the user has a dummy email (typically sandbox access for 3rd parties)

 

It’s been handy for me to know about the system.setPassword() method in the Developer Console.

 

This method lets you specify a specific user, and a text string to become their password.

 

The format is:

 

system.setPassword(‘userId’, ‘newPassword’);

 

The userId above is the 18 character Salesforce User Id for the user you’d like to update the password for, and the newPassword above is, well, the password you want to give that user.

 

Here’s how it works:

 

Step 1: Open the Developer Console

 

 

Step 2: Once in the Developer Console, Open the Execute Anonymous Window

 

 

Step 3: Use the system.setPassword(‘userid’, ‘password’); method specifying the desired userId and desired password. Press Execute.

 

 

You’re done!

 

One tip: the new password must conform to your org’s password policies.

 

And on a final note, only use this method in special situations. Manually setting a users password and sharing it with them is much less secure than them setting it themselves.

 

Always consider the security implications of using this method and make a decision on the risk before using this quick fix.

 

With that, have a great weekend - and I'll see you next week!

 


 

Salesforce Made Simple

Join the Salesforce Saturday newsletter. Every Saturday, you'll get 1 actionable tip on Salesforce technology or career growth related to the Salesforce Industry.

We hate SPAM. We will never sell your information, for any reason.