function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David MartinkaDavid Martinka 

How to change user's email and generate a new password

Hi,
We have quite a large org with many users and thus we do user cleanup on a weekly basis. We always need to deactivate person's user, set profile and role to a proper one, change their email and reset password.

I am able to do almost everything by an apex script, but I'm still unable to change user's email address and afterwards generate a new password. Is there some trick how to do so?

Thanks,
David
Raj VakatiRaj Vakati
This is what is am suggesting .. 
 
  1. First Change the email address and ask the user to accept the email address change. user will receive an link and ask him to click the link 
  2. Reset the password after that