How to Change Salesforce User Login Password Through Developer Console



In Salesforce we can reset the login password without resetting it. We can achieve this through developer console.

Follow the below steps to change the password,

Step 1 : Click user drop down option

Step 2 : Select the Developer Console

Step 3 : Click Debug option

Step 4 : Open Execute Anonymous Window(Ctrl + E)

Enter the below query

SOQL query:

List<User> userList = new List<User>();

set <String> usernames = new set <String> {‘username@company.com’};

userList = [SELECT Id from User WHERE Username in: usernames];

for (User u : userList)

{

System.setPassword(u.Id, ‘password‘);

System.debug(‘DONE: ‘ + u.Id);

}

if (true)

System.debug(‘true’);

else if (false ||

true)

System.debug(‘false’);

now the new password is set to “password