Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Subflow goes to Waiting state after ATF rollback and SCTASK not deleted

BhagyashriS4766
Tera Contributor

I’m facing an issue with ATF rollback behavior in Flow Designer and would appreciate any insights.

Use case:

I have 3 flows/subflows:

Main Flow – triggered on catalog item submission (creates RITM).
Call Orchestration Subflow – invoked by the main flow to process orchestration.
Failure Task Subflow – triggered when orchestration fails.

The failure subflow:
Creates an SCTASK with a choice field ("action to take upon failure").
When "Cancel" is selected and submitted:
Value is returned to parent subflow → main flow.
Main flow closes the RITM as Closed Incomplete.

ATF Behavior:

I created an ATF test case to validate this.
During execution:
All 3 flows execute successfully.
All flow contexts move to Completed state.
Expected behavior works correctly.

Issue during ATF rollback:

RITM gets deleted
Main flow context gets deleted
Call orchestration subflow context gets deleted

However:

Failure Task Subflow context goes back to Waiting state
It gets stuck at "Create Catalog Task" step
The SCTASK created during the test is NOT deleted

Additional observation:

I tried adding a steps to delete RITM record as the last step in ATF to explicitly clean up.
This successfully deletes the RITM.
However, the associated SCTASK still remains undeleted.
Normally, deleting an RITM should also delete its associated catalog tasks, but that is not happening in this scenario.

Goal:

After ATF rollback, there should be no leftover records or contexts.
The failure subflow should not revert to a Waiting state.
Ideally, all related flow/subflow contexts and SCTASK records should be fully cleaned up/deleted.

Questions:

Why does the failure subflow revert to Waiting state after rollback?
Why is the SCTASK not cleaned up during rollback?
Why is the SCTASK not deleted even when the RITM is explicitly deleted via ATF?
Is this expected behavior for subflows that involve task creation/user interaction?
Any recommended approach to ensure proper cleanup in ATF for such flows?
Any help or pointers would be greatly appreciated!

 

0 REPLIES 0