Automated Test Framework (ATF) tests do not rollback the records which have been created / deleted / updatedDescription When an Automated Test Framework (ATF) Test is completed, the platform should roll back any record which has been created/deleted/updated. However, there are times when the rollback does not happen. Cause There are several scenarios that can cause ATF record not to be rolled back: Nothing gets rolled back. This might occur when there is a record in the [sys_rollback_context] which is left in the 'In progress' (in_progress) or 'Currently rolling back reverting' (reverting). This prevents the platform from executing any other rollback.Some files aren't rolled back. ATF only tracks records that are inserted/updated/deleted in the same session. If something triggers record operations under another session ID then that operation will not be tracked (Workflows, Scheduled jobs...).For example, a custom workflow with a timer object will always run on a worker thread under 'System'. Any records created by this workflow (after the timer) will not be captured in the rollback context, updates made by the test will. NEW SCENARIO/SYMPTOM: An ATF test triggering or executing a flow might intermittently not roll back data created by the flow if all processes triggered by the flow/subflow is not completed before the test execution ends. There might a async process or a subflow which is not marked to wait for completion which might cause this behavior.Solution:Design the flow execution step in such a way that the step waits for the flow and all processes triggered by the flow to completeResolutionYou must confirm first that the rollback context currently marked as running is not doing anything anymore: The workaround is to force the sys_rollback_context state back to "recorded" with a script like the one shown below, which updates the table 'sys_rollback_context' bypassing the ACLs on the UI, where the field "State" on the form is read-only: fixContextState();function fixContextState() { var gr = new GlideRecord('sys_rollback_context'); gr.get('___SYS_ID_OF_SYS_ROLLBACK_CONTEXT___'); gr.state = 'recorded'; gr.update();} As the files are left over after the ATF rollback we can clearly identify the sys_created_by user and logically trace from there. If the record was created by a workflow and this uses a timer then consult with the SM team to determine whether it can be substituted.