Creating Subflows

You can create a subflow exactly like you would create any other blank flow.

To create a subflow:

  1. Identify the piece of logic in your app that you want to reuse elsewhere in the app or iterate multiple times.
  2. Create a flow without a trigger for that logic. For more information on how to create such a flow, see Creating a flow without a trigger.
  3. To use this flow as a subflow within another flow, you must add a StartaSubFlow Activity at the location in the calling flow from where you want to call the subflow. For example, if you want to call a subflow after the third Activity in your calling flow, insert a StartaSubFlow Activity as the fourth Activity in the calling flow. To do so:
    1. Open calling flow.
    2. On the flow details page, click the Activities palette.
    3. Under the Default category, select the StartaSubFlow activity and drag it to the activities area.
    4. Add the branches to connect the SubFlow activity with the activity that you want to call a subflow from and to the activity where the subflow must end. Also set the branch conditions for each connection line wherever required.
    5. Click the StartaSubFlow activity to open the configuration dialog. To call the required subflow, select the subflow from the Select flow dropdown in the Settings tab and save the changes. If you want to see the flow in detail, use the Open Subflow option in the Settings tab or click the icon on the StartaSubflow Activity. This appends the active flow in a breadcrumb trail and highlights it. A breadcrumb trail starts with the app name and includes the flows and subflows.
      Note:  
      • If a subflow is already selected on the StartaSubflow activity, then you can directly open it in a breadcrumb trail by clicking the icon on the activity tile.

      • If icon is present on the StartaSubflow activity, it means that a subflow is selected in the StartaSubflow Activity.

      • Several flows can open in a breadcrumb trail. If you click one flow, the child hierarchy disappears and only the parent hierarchy remains.

      The schemas that you had configured in the Input Settings and Output Settings of the Flow Inputs & Outputs tab in the selected subflow appear on the Input and Output tabs of the StartaSubFlow Activity.

      You can now configure the input and output for the subflow in the StartaSubFlow Activity. If you add additional input and/or output parameters on the Flow Inputs & Outputs tab of your subflow, they become available to configure from the Input and/or Output tabs of the StartaSubFlow Activity. The output from the StartaSubFlow Activity is available for use as input in all activities that appear after it.

      At app runtime, the StartaSubFlow Activity in the calling flow calls the selected subflow.

    6. If you want your subflow to iterate multiple times, configure the iteration details on the Loop tab of the StartaSubFlow activity. For more information on how to configure the Loop tab, see Using the Loop.
    7. If you want to run the subflow again in case of an error, you can select the Retry on Error option.

    8. If you want to execute certain events in the main flow without waiting for the subflow to complete its execution, you can do this using the Detached Invocation toggle on the Settings tab of the StartaSubFlow activity. When you set this Detached Invocation toggle to true, the Output option is not available in the StartaSubFlow activity window, and without waiting for the subflow output, the main flow is executed.

    Note: When a subflow activity is configured to run in detached mode, it runs as an independent flow instance and its output is not available to the calling flow. The Retry on Error feature is not applicable to detached mode.