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.

1 Answer 1


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. Commented Aug 19, 2020 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .