Is there a way to trigger the account unlock emails via Apex?

I'm trying to setup a self-service solution where users can enter their username via a form and get the account unlock email, instead of waiting for an admin to unlock it manually.

Thank you.


Copying from this answer -

With below code you can unlock the user and can send your custom email.

UserLogin someDude = [SELECT IsPasswordLocked FROM UserLogin WHERE UserId = 'jndfgl9sfdg08fg'];
someDude.IsPasswordLocked = false;
update someDude;
  • 1
    Thank you very much. While this doesn't trigger the unlock email, I could build my own process around this. Aug 19 '20 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.