1

A new verification feature in the Spring '22 release is that an user will receive a verification email once per release when they instigate an email. I'm trying to use Apex to send a mass email out to those users who have unverified email addresses all at once.

UserManagement Class Apex Developer Guide documentation for sendAsyncEmailConfirmation is here.

Using SF Developer Console's Open Execute Anonymous Window, I am trying to send an email to a user to verify their email.

System.UserManagement.sendAsyncEmailConfirmation(UserId, null, null, null);

I expected the user to be brought to a SF verify account(email) screen similar to this: enter image description here

However, the user is brought to SF login screen: enter image description here

I even tried to set the field HasUserVerifiedEmailAddress from TwoFactorMethodsInfo to false before sending the verification link email, but that still brings the user to SF login screen.

In Dev Console, ran this (which still brought user to login screen): System.UserManagement.deregisterVerificationMethod(UserId,Auth.VerificationMethod.EMAIL); System.UserManagement.sendAsyncEmailConfirmation(UserId, null, null, null);

What syntax is needed to get the unverified email user an email that when clicking the link brings you to a SF Verify Account/Email Screen please? I don't want users to have to change their password. I just want them to be directed to a Verify Account/Email screen where all they have to do is click the button.

TIA!

0

1 Answer 1

1

I received a reply from SF Case that I opened. "This is the expected behavior for internal users. The email verification only allows external users or community users to have a passwordless login. For internal users it expects them to either login or be logged in which is why the login page is loaded. In terms of the dashboard, it would direct them to the default landing page. There are a few ways to tweak this including different Apps, Apex code, Visualforce /Lightning solutions. There isn't an easy way if you are trying to direct them to their own Account record."

You must log in to answer this question.

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