How to Manually Set A Users Password

I’ve often thought it would be so much easier if we could manually set a users password to a password of our choice instead of having to send a password reset email.

It turns out, you can! Follow the steps below.

Step 1: Open the Developer Console

How to open the Developer Console in Salesforce Lightning Experience.

Step 2: From inside the Developer Console, click “Debug” -> “Open Execute Anonymous Window”

Step 3: Enter the following code and click “Execute”.

system.setPassword('userId', 'password');

You’re done. You just manually reset a password!

BONUS: You can use a very similar method to send password reset emails too.

Follow the same steps as before, except this time enter the following code instead.

system.resetPassword('userId', true);

The true or false condition determines whether the user will receive an email asking them to reset their password. Set the condition to True if you want the user to receive a password reset email and set the condition to false if you don’t!

Hopefully this helps!

One thought on “How to Manually Set A Users Password”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.