Teneo Developers

Share to

Sub-Flows

Sub-Flows are often used for re-usable pieces of logic. For example, you might have a solution in which multiple flows need to ask for a date of birth. In that case, one single Sub-Flow that asks for the date of birth can be used. This Sub-Flow can then be called by any flow that needs the user's date of birth.

Unlike regular flows, Sub-Flows are not triggered by a user input. In fact, Sub-Flows do not have triggers at all. Sub-Flows can only be activated when linked to from other flows.

Linking to a Sub-Flow

Once the Sub-Flow has finished processing, execution will be handed back to the parent flow. One flow can link to multiple Sub-Flows, which will behave as if they were part of the parent flow. Sub-Flows can also link to other Sub-Flows. When linking to a Sub-Flow you can specify which variables can be transferred back and forth. If an output in the Sub-Flow uses a revisitability limit and that limit is exceeded, the Sub-Flow and all calling flows are dropped.

linking subflow

Creating a Sub-Flow

Sub-Flows are created as easily as regular flows by creating a flow and selecting 'Sub-Flows' from the dropdown.

create sub flow

Once a Sub-Flow has been created, it will look something like this:

sub flow entry point

Linking to a Sub-Flow

Sub-Flows are ideal for reusable logic. In this example, we have created a Sub-Flow to get the user's email address, which could be needed for various use cases:

get email address sub flow

We can then call this Sub-Flow from other flows to get the user's email whenever necessary. In the example below, we used this Sub-Flow in a Flow where we add the user to a mailing list.

calling sub flow from main

When calling a Sub-Flow, we can send and receive values to and from the Sub-Flow. In this case, we do not send any values, but we receive one (i.e. the email address).