What is a sub-flow and how to use it

A sub-flow allows you to have more than one source in a flow. Multiple sources can be used to push data/ records into one or more destination/s.

Below is an example of a flow with a sub-flow. The Record Generator step is used as the primary source and Salesforce source step is used as the secondary source. The sub-flow pushes the records from both sources into a buffer as a destination.

In the Record Generator step, I created my own field called “Number” and gave it a value as shown below.

image

In the Calculator step, the Number field is being used as a parameter to pass the field with it’s value to the sub-flow as highlighted below. “NumberTest” is the created name for the parameter field.

image

In the Salesforce source step, a connection to Salesforce was created and there are certain fields that were selected from the Account object as illustrated below.

Click on the below icon in the sub-flow to choose the return value.

image

The below page will appear and you can select a Type and Source and save. I chose “Object” as a Type since my sub-flow is pulling from Salesforce as a source and I selected “Record” to show the results as an output for the sub-flow. I created a field called “Mappings” in the Add To Record As field.

NB: If there is no source in the sub-flow, choose “Current” as the Return Type.

The output is highlighted in the below image. The Number field and value from the Record Generator is being passed as a parameter and the fields from Salesforce are in the Mappings field.

Additional information:

Returns

The options below let you define how you want the data to be returned from the Sub-flow.

Return Type

Select the option type you want the Sub-flow value to be returned as one of the following:

  • None - No return. This is equivalent to void in traditional programming
  • Current - The default of the sub-flow being called
  • Array - Converts the output to an array
  • Object - Converts the output to an object
  • String - Converts the output to a string
  • Binary - Converts the output to a binary representation

Return Source

Selects what value types to return from the flow you are calling.

  • Auto - Auto detects the appropriate output
  • Record - Returns the current record processed by the sub flow.
  • Output - Returns the output of the Writer Step (if any) in the sub flow.
  • Result - Returns the output of the Destination Step (if any) in the sub flow.

Add to Record As

Adds the return to the current record in the parent flow as the field specified.