This post explains how to set and reset the password using apex in salesforce
resetPassword method accepts two parameters
Id (UserId): Id of the user
Boolean: it represents the send email to user or not
setPassword method accepts the two parameters
Id (UserId): Id of the user
String: new password value.
Reset Password
DemoresetPassword method accepts two parameters
Id (UserId): Id of the user
Boolean: it represents the send email to user or not
System.resetPassword(Id.valueOf('005B0000005lewT'), true);
when you run the above code, salesforce sends a password reset link to the userSet Password
DemosetPassword method accepts the two parameters
Id (UserId): Id of the user
String: new password value.
System.setPassword(Id.valueOf('005B0000005lewT'), 'test@12345');
when you run the above code salesforce will set the new password to the user.
No comments:
Post a Comment