Ad
Ad
Ad
Category

Uncategorized

Category

In this post, We will try to understand how to reset or set a password using Execute Anonymous. At times we want to set or reset a password for some generic users or admin users. We can use System.setpassword() method provided by Salesforce to achieve the desired result from developer console.

Steps to Execute:

  1. Login to Salesforce
  2. Click on setup and Select Developer Console
  3. From Developer console, Navigate to Debug and select Open Execute Anonymous Window
  4. Enter System.setpassword command as shown in the screenshot
  5. Click on Execute

System.setPassword(User,password);

user–Enter the 15 digit or 18 digit userid of the desired user

password — Enter the desired password for the user

Setup–> Developer Console–>Debug –> Open Execute Anonymous Window–>Setpassword method–>Execute

Pro Tip: Developer Console caches your previous settings so once you reset it remove the command from the Developer console and execute it. If someone else ever logs in as you and opens developer console they will see the command and password. For this reason, we want to remove the command from developer console once the password is reset.