About child Flows
In some cases, such as when you are working with lists, you will need a Flow to call another Flow. Such Flow pairs are called a parent Flow (the caller) and child Flow (the Flow being called). Once the child Flow is called by the parent, it becomes active and runs. Otherwise, it remains inactive.
Use cases for child Flows
Child Flows are useful in these scenarios:
You have a series of steps that get used more than once in a single Flow or across multiple Flows. Moving them into their own "child Flow" lets you create them once and then reuse them repeatedly. You run the steps from other Flows by using the Call Flow or Call Flow Async functions.
You want to process a list, one item at a time. For example, you can run a series of steps on each list item using the For Each function or you can transform a list into a new list (one item at a time) using the Map function.
You just want to break a very large Flow into smaller, more manageable parts.
Outputs from child Flows
Each Child Flow card has the following outputs:
Inputs to this Flow: Click to create custom fields, one at a time. Give each a name and data type (such as Text or Number). Each custom field you create corresponds to an expected input from any Flow that calls your child Flow.
Context : The outputs in this section are automatically assigned values every time the Flow runs:
Index - This number output is assigned a value when the Flow is called from a function that loops through the items of a list (such as the For Each or Map functions). The value of Index corresponds to the item's position in the list (starting with zero) processed by this particular instance of the Flow.
Caller - The keys of the Caller object tell you which Flow called the child Flow (id and name), which particular execution of the Flow made the call (execution_id), and which particular step in the Flow (method, which is an unique ID). When the child Flow is manually run, then id and execution_id are null. This is especially useful for debugging purposes.
Error - This object output is assigned a value when the Flow is called for error handling. See Set error handling. The value of Error corresponds to the raw error object returns by the application or action that caused the error -- e.g. an object that will often have keys that include "message", "statusCode" and "execution" (the unique identifier of the Flow execution that caused the error, which can be used to construct a URL to the execution history that shows the Flow details that led to the error).
Execution ID - the unique ID of the Flow instance.
A child Flow must be turned on before it can be called by other Flows.
Child Flows don't count towards your Active Flow limit since they are directly dependent on other Flows.
Using child Flows with List functions
Child Flows are helpful for List Functions because they allow you to go through each item of a list. These child Flows can have inputs that correspond to the type of item in the list, function perform a task on each item, and a return (found in the Control category).
For example, you can convert an object into a list of objects, where each key/value pair is converted to object that has
propertyvalue keys. This is a common pattern among cloud APIs. The
propertyname also needs to be prefixed with
custom:. You can do that with a child Flow - it accepts key, value, and a constant prefix (which is the same across all iterations - the parent Flow passes this in), and returns back an object with two keys.
That Flow, when used with object.map, will turn this object: