Flow Designer: Subflow marked as complete in parent flow before subflow execution finishes

JayAdmin_16
Mega Sage

Hi everyone,

 

The flow below loops through the selected resources then calls an Azure Account Access subflow within a Do the following in parallel block. The wait for completion option is intentionally not enabled on the Azure Account Access subflow, as we need all actions within it to start simultaneously to avoid bottlenecking the process particularly when multiple SCTASKs need to be opened at the same time.
JayAdmin_16_0-1776141693846.png

 

The challenge we’re seeing is that the Azure Account Access subflow in the main flow is marked as Stage = Completed in the Execution Details while steps in the subflow are still waiting. As a result, the subsequent subflows to Close Request Item and Close Request are triggered before the subflow processing has fully completed, preventing the closure of the respective RITM & REQ tasks. 

We would prefer to avoid using a Business Rule and keep the solution scoped to Flow Designer wherever possible. We’d also like to avoid using a “Do the following until”, as we don’t want to consume unnecessary platform resources.

Thank you for your help in advance, 
2 REPLIES 2

Mathias Vandend
Mega Sage

This is a common gotcha with subflows that contain async actions like REST calls.
the parent flow marks the subflow step "complete" once it's dispatched, not when it actually returns.

What's worked for me: add a Wait for Condition action right after the subflow call inside your loop. Have it check for the actual outcome you expect - like a field update on the target record that the subflow sets at the very end. That way the loop won't iterate to the next resource until Azure has actually responded and your subflow has finished processing.

If your subflow doesn't currently write a "done" flag, add a final action in the subflow that updates a field on the resource record (something like u_azure_provisioned = true). Then your Wait for Condition in the parent flow checks for that.

One thing to watch: make sure your Wait for Condition has a reasonable timeout so you're not stuck forever if Azure doesn't respond.

Docs on Wait for Condition: https://docs.servicenow.com/bundle/tokyo-application-development/page/administer/flow-designer/refer...

lauri457
Tera Sage

Just put the loop inside the subflow and tick wait for completion in the subflow call in the main flow