Use the Developer Console to force password resets in Salesforce

When using the Developer Console to force password resets for newly created users, the setPassword method of System Class may redirect users to the "Change Your Password" page. Clicking on any text box allows the user to log in to the org without setting the security questions.  

Note: If you have used setPassword() to configure a user's password and they have never set a security question, they will be redirected to the Change Your Password page upon login.

Steps to set a password 

Open Developer Console

Open the Execute anonymous window > Write : system.setPassword('005xx0000000XXX', 'passwordText');  i.e System.setPassword(userid, password);

Click Execute

Click on the gear icon below the screenshot and select ‘Developer Console’










A new window will open -

You need to click on Debug → Open execute Anonymous Window












A new window will open, add the below command, and click on execute. 

System.setPassword(userid, password);




Comments

Popular posts from this blog

Introduction to Salesforce Agent Script: Build Predictable AI Agents

Anti-Patterns in Salesforce Agentforce: What to Avoid When Building AI Agents

MCP vs. Traditional APIs: Choosing the Right Integration Approach