Loading

Identity Verification records are not saved when Database.rollback is invoked in the same transaction

Julkaisupäivä: Oct 7, 2026
Kuvaus

You can implement a custom multi-factor authentication (MFA) service in Apex by using the System.UserManagement class methods. The verification step is completed with the UserManagement.verifyVerificationMethod() method, which creates a VerificationHistory record that is visible in Setup under Identity Verification History.

The VerificationHistory record is committed to the database at the end of a transaction by a transaction observer that is registered when UserManagement.verifyVerificationMethod runs. Calling Database.rollback in the same transaction removes this transaction observer, so the record is not committed to the database, regardless of where in the transaction the savepoint was created.

Ratkaisu

This article explains why Salesforce Identity Verification History records are not saved when Apex calls Database.rollback in the same transaction as UserManagement.verifyVerificationMethod, and how to avoid the problem.

How to Keep Verification History Records When Using Apex Custom MFA

Avoid calling Database.rollback in any transaction where you need the Verification History record to be committed to the database.

Knowledge-artikkelin numero

005390889

 
Ladataan
Salesforce Help | Article