About Sync and Async Sub-Flows

Last Updated: 05/02/2018 Introduced in Version: 2.0

Overview

A Sub-Flow is a Flow that runs like a Step in the course of another Flow. Sub-Flows may also be referred to as a “Child Flow” and the primary Flow as a “Parent Flow.”

A Sub-Flow may be set to run in one of two ways:

  1. The Sync method, which pauses the primary Flow until the Sub-Flow completes
  2. The Async method, which does not pause the primary Flow until the Sub-Flow completes

Each method has benefits, and part of your Flow design planning should be to decide which method to use in given scenarios. The key difference is that the Sync method will cause the primary Flow to remain in a wait state (i.e. keep running) until the Sub-Flow completes. The Async method tells the primary Flow not to wait for the Sub-Flow to complete. (In legacy versions of Decisions, the Async method is called the “Fire and Forget” method.) With Async, control is immediately given back to the primary Flow. The consequence of this method is that the relationship between the two flows is “asynchronous,” Meaning that the Sub-Flow is now an independently executing Flow, and has no necessary output data to deliver to its primary Flow.

Example

In the screenshot below, the gray colored Error Handling Flow is a Start Linked Flow Async step. In this example, the Sub-Flow is designed for error handling. When an exception is caught (by the Catch Exception step), the Sub-Flow then tasks an administrator to look into the error. In this case it makes sense to use the Async method because the primary Flow should hit its End step and finish regardless of the status of the error handling. In other words, the primary Flow should not wait for the tasked administrator to look into the problem before it ends.

This is a common, best-practice application of an Async Sub-Flow.

asynchronoussubflow

 

http://www.screencast.com/t/D0MrabrbLwc

 

 

Additional Resources