Flow Designer: Subflow marked as complete in parent flow before subflow execution finishes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
Hi everyone,
Thank you for your help in advance,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Just put the loop inside the subflow and tick wait for completion in the subflow call in the main flow
