+ Start a Discussion
santoshasbesantoshasbe 

Reset password using data loader

we have to add 200 users every month . But we want to reset the password using data loader at a later stage after adding the users.
Is this possible?
Chirag MehtaChirag Mehta

Develop a small JAVA or NET code which will call resetPassword Webservice API

 

Syntax
string password = binding.resetPassword(ID userID);

 

Use resetPassword() to request that the API change the password of a User or SelfServiceUser, and return a system-generated password string of random letters and numbers. Use setPassword() instead if you want to set the password to a specific value.

 

Your client application must be logged in with sufficient access rights to change the password for the specified user. For more information, see Factors that Affect Data Access.

Sample Code—Java

public void resetPasswordSample() {
// Specify the user ID of the password to reset
ID idToReset = new ID("005x0000000fFLnAAM");
// Invoke the resetPasswordResult call
try {
ResetPasswordResult resetPasswordResult = binding.resetPassword(idToReset);
// Display the new server-generated password
System.out.println(resetPasswordResult.getPassword());
} catch (Exception ex) {
System.out.println("An unexpected error has occurred." + ex.getMessage());
}
}

 

 

JamesWJamesW

Is there anyway I can use setPassword from Apex? If so, does anyone know the syntax? Right now I am getting Method does not exist or incorrect signature: setPassword(String, String).

 

Thanks in advance,

 

James