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
Saurabh.rawane.ax708Saurabh.rawane.ax708 

Changing User's Email using Apex

Hi,

 

I need to change Users Email address using apex without user having to confirm the new Email Address, is there a way i can achieve it.

 

Thanks!

yudhvirmoryudhvirmor

Apex data loader should do the job..

SurekaSureka

Hi,

 

Even using the Apex data loader, the User will still be noted on the change of email address.

 

Thanks

Ashish  VermaAshish Verma
As security measure in Salesforce, when admin change user email address (maybe in sandbox, typo or other reasons), Salesforce will send an verification email to the new email address, user need to verify by click a link in the email. Before user verify the link, email address will not change, no matter how many times you do it, even using API.

But, can admin change the email address without confirmation email? Yes, here is the trick:
Click Edit on user detail page
Change the email address AND check "Generate new password and notify user immediately" checkbox (all the way at the bottom of the edit screen) at the same time
Click Save buttonSalesforce will change email address immediately, no confirmation is needed! But, of course password will be reset and user will get email from Salesforce with a new temporary password. This is still better than ask user to verify email changed then reset password.