Using Sub Flows
  • 17 Jun 2022
  • 5 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Using Sub Flows

  • Dark
    Light

Overview

Sub Flows (aka Child Flows) are steps in the FloDesigner that represent a preexisting Flow that can be added via the Flows category in the Steps tab. Sub Flows contain all the steps, along with their Inputs and Outputs, that were created to perform a specified function. 

When a Sub Flow step is used in multiple Flows it is referred to as adding a Child Process. Given that the Sub Flow is commonly known as a Child Flow, the Main Flow that houses added Sub Flow, is referred to as its Parent Flow.

Additional Information on Sub Flows 
Note that Sub Flows may be used within subsequent Sub Flows. For example, one main Main (or Parent) Flow may contain a Sub Flow, which houses another Sub Flow that executes a separate purpose, which also houses its own separate Child Flow, so on and so forth. 

The Parent Flow will initiate a Child Flow when it reaches it within the main process and will wait for the Child Flow to complete before moving forward.

For many applications, making frequently used steps or processes (such as Sending an Email, Saving an article, Creating an alert Notification, or performing Error Handling) into a Sub Flow simplifies an application's design given that a change in the Sub Flow will be reflected in all Parent Flows. This also helps to simplify the Flow Designer's workspace and keep the focus on key processes that are distinct to each Flow.


Example

About the Example
The following example Flow utilizes a Sub Flow as a means for Error Handling in an insurance policy request process by using a Catch Exception step.

The Form and Create Data steps are used arbitrarily as this design mentality and layout may be applied to other instances that require catching an Exception within a process.
  1. From the Flow Designer, attach a Show Form step to the Start step and navigate to its Properties tab. From the Properties tab, select Pick or Create Form then PICK the desired Form.  
    About the Form
    The example Form being utilized contains several Text Box components that are used as Input for a customer submitting an insurance policy request.

  2. From the Properties tab of the Insurance Policy Request Form step, set each Input to Ignore

  3. Next, attach a Create Data step to the Insurance Policy Request Form step. From the step's Properties tab, select Show Editor and create the desired Data Definition.

    About the Data Definition
    In this example, the Create Data step is used to create the data for the Insurance Policy Data Type which is a Folder Extension

  4. From the Properties of the Create Data step, set the Input data to Build Data, then Select From Flow map the Outputs from the Form to their respective Inputs.

  5. From the Properties of the End step, under Outcomes, enable Add Outcome for Exception.

  6. Drag out the resulting On Exception path. Then, search for and ADD a Catch Exception step. 
    About Step
    The Catch Exception step is used to "catch" then output information in the event the Flow "throws the Exception" (encounters an error). This information is output in the form of an Exception Message

  7. From the Favorite Steps category of the Steps tab, attach a Run Sub Flow step to the On Exception path of the Catch Exception step. From the Properties of the Run Sub Flow step, under Target, click Create, then CREATE a new Flow. 

    About Sub Flow
    This Sub Flow will be used as a means of assigning the ExceptionMessage to a user that is designated to process errors in the application process. 

  8. From the resulting Flow Designer for the Sub Flow, define four String Inputs on the Start step that correspond with the  ExceptionFullTrace, ExceptionMessage, ExceptionStack, and ExceptionTypeName of the resulting Exception Message. 

  9. From the Favorite Steps category, attach a Show Form step to the Start step. Then, from its Properties tab, click Pick or Create, then CREATE a new Form.

  10. From the Form Designer, add each previously created Exception Input by dragging each one from the Data tab and selecting the Label Of Data Value option for each one. Complete the Form with a Button component Labeled "Close". Save then Close the Form Designer. 

    About Form
    This Form will be used to Assign and display the Exception Message to the designated Error Handler

  11. From the Flow Designer, attach the Close path to the End step. Then, from the Properties tab of the Form step, under Assignment, Assign the Form to an Account by changing the Assignment Type to Assign To and providing an Account under the Assign To Input. 

  12. Still in the Properties tab of the Form, provide an Assignment Name and Assignment Action Name

    Additional Information
    Though presently the Flow will only display the Exception Message, any additional processing logic be added to the Sub Flow

  13. Save and Close the Sub Flow. 

  14. Back in the Parent Flow's Flow Designer, from the Run Sub Flow step's Properties, map ExceptionFullTrace, ExceptionMessage, ExceptionStack, and ExceptionTypeName to their respective Inputs in the Child Flow. Save and if desired Close the Flow. 

    About Flow Configuration
    With this configuration, in the event of an Exception, the Catch Exception step would output an Exception Message to the Sub Flow which will assign the Catch Exception Form to the desired Account for processing. After clicking the Close button and leaving the Form, the Main Flow will finish. 



Running a Sub Flow Asynchronously 

To aid with time management, Designers may run multiple processes in parallel by running processes that would typically run synchronously, asynchronously instead. This can be achieved by enabling the Run Flow Async and Wait Property on the Run Sub Flow step. 

Additional Resources 
For further information and use cases regarding asynchronous Flow Behavior, see About Sync and Async Sub Flows.


Selection Types

Similar to the standard Flow, Sub Flows may utilize a variety of Selection Types that may affect both how and when the Sub Flow runs. 

To view the Selection Types:

  1. Add a Run Sub Flow step from the Steps tab in the Flow Designer
  2. Click on it to view its Properties and expand the Advanced section to locate Selection Type. 

Sub Flows may choose between the following three Selection Types:

Selection TypeDefinition
Pick (Default)Allows the Designer to pick a Child Flow that runs once the Parent Flow progresses to the Run Flow Step
Runtime SelectionInitializes the Child Flow at runtime, reduces memory demands of Parent Flow preventing crashing
Champion/ChallengerInitializes the Child Flow against other Child Flows against changing logic to promote the most optimal solution


Sequential Rules

Though typically utilizing the Create Rule action redirects to a Rule Designer, creating a Sequential Rule instead opens a Flow Designer.

Both template options for Sequential Rules; Data Return Rule and True/False Rule; operate similar to a Sub Flow within Decisions, with the exception that the True/False Rule template has True and False End step instead of the typical single End step. 

Note on Sequential Rules 
Though Sequential Rules can be considered Sub Flows, they are not referenced in any Rule Picker in the environment. 



Was this article helpful?