- 21 Jun 2023
- 5 Minutes to read
- Updated on 21 Jun 2023
- 5 Minutes to read
A Sub Flow is a component of a Flow that is used to break down larger, complex Flows into smaller, more manageable tasks. It is essentially a self-contained Flow that is designed to perform a specific task or set of tasks that contribute to the overall process. It can be designed and tested independently and then called upon by the larger Flow when needed, helping to streamline and simplify complex Flows.
One of the key benefits of using Sub Flows is that they can be reused across many Flows and/or Projects. Once a Sub Flow has been designed and tested, it can be called upon whenever and wherever that specific task or set of tasks is required, saving time and effort in the design and development process.
Another advantage of using Sub Flows is that they allow for greater flexibility and scalability in process automation. By breaking down larger workflows into smaller, self-contained tasks, it becomes easier to make changes or modifications to individual tasks without disrupting the overall workflow or process.
A Sub Flow can be configured in two ways:
- Synchronously: allows the Sub Flow and Parent Flow to run sequentially.
- Asynchronously: allows the Parent Flow to run independently while the Sub Flow completes.
With an Asynchronous Flow, control is immediately returned to the Parent Flow. This results in the two Flows being asynchronous, meaning that the Sub Flow is now an independently executing Flow and has no necessary output data to deliver to the primary Flow.
Synchronous Flows are utilized to effectively manage processes that require a sequential execution of the Parent Flow and its Sub Flows.
To illustrate this, consider the following example. The email handling process is divided into multiple synchronous Sub Flows based on the evaluation of the email. Once the email reaches the Process Folder step, it undergoes assessment to determine if it is an invoice, a resume, or falls under any other category. Accordingly, it is then directed to the appropriate Sub Flow. This approach enables the execution of a Sub Flow in the middle of the overall process, allowing for the return of data to the Parent Flow before moving on to the next step. This becomes particularly useful when the process requires a manager's approval or user response. Moreover, breaking down the Flow into separate sequences makes it easier to evaluate and troubleshoot each section independently.
Start Linked Flow Async Step
The Start Linked Flow Async step is a Sub Flow that runs independently from the Parent Flow. The primary purpose of Async Flows is for use in instances where the Parent Flow needs to delegate a task to the Sub Flow. Async Flows run as a System user and not the initiating user.
In the screenshot below, whenever an email is found, it is delegated to the process workflow to be filtered by a Rule. In this case, the async method allows the Parent Flow to check for emails while the Sub Flow processes each one individually.
Run Flow Async And Wait Option on Run Flow Step
The Run Flow Async And Wait is a check box configuration on the Run Flow step that does not run the Sub Flow independently from the parent process but executes it on a separate thread. This option is used to spawn a new process, run the Flow on a separate thread, then return the data to the primary Flow. This is helpful in scenarios involving multiple steps involving a loop or branch usually running synchronously, such as API calls or adding numbers. The Run Flow Async and Wait options allow these tasks to be executed in parallel to save time. The Run Flow Async and Wait option is most commonly enabled to assist with API calls that return large amounts of data.
Run Flow Async and Wait will return data, unlike the Start Lined Flow Async step.
Go Async Flow Step
The Go Async step is used to move the current execution of the Flow to a different thread. This allows users more precision when directing which portion of a Flow is run async. Users may run portions of a Flow async without having to move the whole process.
List of Async Steps
The following steps cause a Flow to go into an async state.
|Pause Flow||Delays the processing of the proceeding step until a specified time has elapsed.|
|GoTo Step||Used to jump from the current position of a Flow to another step|
|Run Flows for List [Batch Processing]||Processes a list by running a Flow for each list item.|
|Go Async||Allows subsequent steps to run asynchronously.|
|Throw Exception||Allows custom exception to be triggered.|
|Wait on External System||Delays processing until a desired condition in the External System occurs.|
|Add Task||Assign and display a Form to a user.|
|Finish Import Async||Completes an import session.|
|Run Sub Flow Step||Allows a user to run a Sub Flow.|
|Branch ForEach Step||Similar to a ForEach Step, but allows branching and incomplete loops.|
Checking Flow Element Attribute
To determine if a Flow is Sync or Async after it has been created without opening it, users may utilize the information provided by the Element Attribute in the Flow's PROPERTIES on the Info panel in the Flow Designer. This property provides information on the selected Designer Element, such as its Type and the run behavior. This information is located in the Information Panel that appears upon selecting any space within the Designer Project's Report row for that specific Flow.
Implementing Sub Flows
|Adding a Sub Flow step|
|Inputs/Outputs for Sub Flows|
|Running a Sub Flow Asynchronously|
The Run Flow Async and Wait options allow tasks within the Sub Flow to be executed in parallel to save time. The Run Flow Async and Wait option is most commonly enabled to assist with API calls that return large amounts of data.
This checkbox is found under Properties > Advanced above the Selection Type setting.
|Dynamically Running Flows in the Sub Flow|
The 'Runtime Selection' feature on the Sub Flow step allows running a Flow dynamically based on specific runtime conditions.
|Creating Sub Flows Using Existing Steps|
Create Sub Flows by using existing logic in the Flow Designer to organize large Flows and break up business logic into reusable pieces. If data is required on the inputs and outputs of the steps that will make up the new Sub Flow, that data will automatically be added as input and output data.