You need to sign in to do that
Don't have an account?
INVALID_NEW_PASSWORD using Apex setPassword
Hi,
I have the following method that calls setPassword:
public PageReference setPassword() {
results = '';
isActionSuccessful = false;
ApexPages.Message myMsg;
try {
for (User u : getSelectedSobjects()) {
System.setPassword(u.id,passwordString);
}
results = 'Users updated successfully.';
isActionSuccessful = true;
myMsg = new ApexPages.Message(ApexPages.Severity.CONFIRM, results);
} catch (Exception e) {
results = e.getMessage();
myMsg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Error updating users: ' + results);
}
PageReference p = Page.SUMOAction;
return p;
}
However, if the password violates the Org Password Policy, the resulting INVALID_NEW_PASSWORD Exception is not caught - I just see "An unexpected error has occurred. Your development organization has been notified." on the screen.
Why is INVALID_NEW_PASSWORD not catchable?
Did you find the solution to this problem. I want to catch this and compare it.
Please share your experience on this issue.