1

When the users email address is changed an email is sent to the user asking them to verify the change of the email. The user then clicks on the link and confirms the email change.

Is there anywhere in Apex that I can see if the verification is successful or is there a flag that is set somewhere?

5
  • This may be an x-y problem. Can you explain why you need this?
    – gNerb
    Apr 20 '20 at 14:22
  • @gNerb as part of a post copy I'm trying to reset users passwords, and the only way is for the user to confirm they've verified the email change. Some of the things I've tried is setting their password to a random string, but even this the user will have to wait 24 hours to try and reset their password. So ultimately I'm trying to see if the user has verified their email change then initiate a system.resetPassword for that user
    – Minz
    Apr 20 '20 at 15:00
  • I'm not sure why you would need to do this, After copying, the password is the same as their production password, they shouldn't need to reset their password after confirming their email.
    – gNerb
    Apr 20 '20 at 16:47
  • as part of the clients requirements, sandboxes passwords must not be the same as prods passwords
    – Minz
    Apr 20 '20 at 18:11
  • User perspective: they shouldn't have to verify email change from sandbox-mangled (.invalid) to valid, they didn't change it to .invalid. Best practice is to skip email verification for this specific post-refresh step in the sandbox.
    – identigral
    Apr 20 '20 at 19:50
1

Yes, you can see these changes in the setup audit trail in setup find this document for what the admin changes you can track in setup audit trail Setup audit Trail. You can simply query on that object and perform action whatever you want via this query.

SELECT Id,
    Action,
    CreatedBy.Name,
    CreatedDate,
    Display,
    Section 
 FROM SetupAuditTrail 
2

SetupAuditTrail is a working option, but not working very well because the related user is only available from the Display field, which can not be used in a WHERE clause.

The better option is to use the TwoFactorMethodsInfo object. You need to grant "Manage Two-Factor Methods through API" / "Manage Two-Factor Methods through the UI" permission first to see this object.

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.