How to Setup a Workflows Helper Flow (With For-Each and Streaming Cards)
Tags: nocode, workflows, tutorial, ipaas
Published: 2022-09-01 18:37:56

---
title: How to Setup a Workflows Helper Flow (With For-Each and Streaming Cards)
published: true
date: 2022-09-01 06:10:23 UTC
tags: NoCode, Workflows, Tutorial, iPaas
canonical_url: https://maxkatz.net/2022/08/12/how-to-setup-a-workflows-helper-flow-with-for-each-and-streaming-cards/
---

[Okta Workflows](https://www.okta.com/platform/workflows/) how-to guides are questions and answers from weekly community [office hours](https://calendly.com/oktaworkflows/group-office-hours-okta-workflows), MacAdmins [Workflows Slack channel](https://www.macadmins.org/), and other places. 

Read all the other how-to guides ⤵️
{% embed https://dev.to/oktaworkflows/all-okta-workflows-how-to-guides-4nl9 %}

On to the question. 

**_How do you setup a helper flow?_**

Workflows has a number of cards that can perform a search for records. For example, **Okta – List Users with Filter** lists users by status:

[![Searching for users card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_start2.png?w=496)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_start2.png)
<figcaption>Searching for users card</figcaption>

A search card will build a list of records. A helper flow is then used to process each record from the list. Using the example above, once you have a list of users, you might want to check when was the last time a user signed into a system.

There are two ways to send the records to a helper flow:

1. A list of records is passed to a **List – For Each** card. The **For Each** card then calls a helper flow for each record in the list
2. A search cards uses the **Stream Matching Records** option. The streaming option directly streams each record to the selected helper flow

In general, the streaming option is more scalable and allows for a significantly larger number of records to be processed. Learn more [about data streaming with action cards](https://help.okta.com/wf/en-us/Content/Topics/Workflows/learn/about-streaming.htm).

Let’s look at examples using for-each and streaming options.

## Using a List – For Each card

In this section you will learn how to setup a main flow and a helper flow using **List – For Each** card.

### Setting up a helper flow

A helper flow is a flow that is called from another flow (main flow). A flow becomes a helper flow when the first card is **On Demand – Helper Flow** :

[![Choosing Helper Flow event](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_addevent.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_addevent.png)
<figcaption>Choosing Helper Flow event</figcaption>

[![Helper flow first card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_start.png?w=528)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_start.png)
<figcaption>Helper flow first card</figcaption>

A helper flow will have one or more inputs which are passed to it from the main flow (or calling flow). In the example below, a helper flow has two inputs **User** (type **Object** ) and **email** (type **Text** ):

[![Helper flow with two inputs (User, email)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_helper_start.png?w=530)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_helper_start.png)
<figcaption>Helper flow with two inputs (User, email)</figcaption>

Looking at the complete helper flow, it gets passed two input values: **User** and **email** :

[![Helper flow](https://katzmax.files.wordpress.com/2022/08/workflows_howot_helperflow_helperflow.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howot_helperflow_helperflow.png)
<figcaption>Helper flow</figcaption>

This flow doesn’t do a lot besides reading values passed to it. But that’s fine, the purpose of this blog post it to show you how to setup a helper flow/main flow.

Using the **Object – Get** card you can retrieve (get) a specific value from an object. In this example the **Email** is retrieved.

The **Flow Control – Assign** card takes the **email** input to the helper flow and assigns it to another value (also called email). This can be helpful if you need to use the email later in a flow.

Let’s look at the main flow.

### Setting up a main flow

The main flow is a regular flow and will call the helper flow. To start you need a search card that returns a list of records. The flow below uses **List Users with Filter** card. The **Options** field is set to **First 200 Matching Records** :

[![Card options](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_stream_options1-1.png?w=490)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_stream_options1-1.png)
<figcaption>Card options</figcaption>

[![Returning first 200 matches option](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_options.png?w=494)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_options.png)
<figcaption>Returning first 200 matches option</figcaption>

The list is then passed to **List – For Each** card:

[![Passing deprovisioned users to a helper flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_mainflow2.png?w=827)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_mainflow2.png)
<figcaption>Passing deprovisioned users to a helper flow</figcaption>

Next you choose a helper flow to run for each record.

This important. Once you choose a helper flow, its inputs will be loaded on the **For Each** card.

For each helper flow input field click the arrow (on the right side of a field) and select a value and a type to pass to the helper flow. The type needs to match the type the helper flow expects.

[![Choosing a helper flow and setting its inputs](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_gif.gif)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_gif.gif)
<figcaption>Choosing a helper flow and setting its inputs</figcaption>

This is also important. If you update helper flow inputs, you need to repeat choosing a helper flow again (yes, it’s a bit annoying). Once you choose the helper flow, the inputs on **For Each** card will be updated based on the changes you made.

Here is another look at setting values passed to the helper flow.

First you are passing: **User**![➡](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/27a1.png) ( **Item** , type **Object** ):

[![Selecting values to pass to the helper flow (User)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_passed_value1.png?w=679)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_passed_value1.png)
<figcaption>Selecting values to pass to the helper flow (User)</figcaption>

Then you are passing: **email**![➡](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/27a1.png) ( **Email** , type **Text** ):

[![Selecting values to pass to the helper flow (email)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_passed_value2.png?w=692)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_passed_value2.png)
<figcaption>Selecting values to pass to the helper flow (email)</figcaption>

This is how the main flow and the helper flow look together and how data is passed:

[![Passing data from main flow to helper flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_mainflow_mapping.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_mainflow_mapping.png)
<figcaption>Passing data from main flow to helper flow</figcaption>

Running the main flow:

[![Testing a main flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_run1.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_run1.png)
<figcaption>Testing a main flow</figcaption>

Helper flow invocations will be equal to the number of records in the list (in the example below, the list contained three users):

[![Running a helper flow (3 times)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_run2.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_run2.png)
<figcaption>Running a helper flow (3 times)</figcaption>

## Using Streaming Matching Records option

In this section you will learn how to setup a main flow and a helper flow using the streaming option. As in the first part, you will start with the helper flow first.

### Setting up a helper flow

As in previous section, a helper flow is a flow that is called from another flow (main flow). A flow becomes a helper flow when the first card is **On Demand – Helper Flow** :

[![Helper flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_start.png?w=528)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_start.png)
<figcaption>Helper flow</figcaption>

With the streaming option you also define helper flow inputs. But, the inputs are a bit different.

You need to create two helper flow inputs:

- **Record** (type **Object** )
- **State** (type **Object** )

[![Helper flow with inputs for streaming](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_stream_inputs1.png?w=480)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_stream_inputs1.png)
<figcaption>Helper flow with inputs for streaming</figcaption>

**Record** is the current item, in our example **User**. This is the item that is being streamed (sent) to the helper flow. You have access to all its properties.

With **State** , you can define any additional inputs to pass to the helper flow.

You will come back to the helper to create flow inputs. Next you are going to setup the main flow.

### Setting up a main flow

If a search card has a **Stream Matching Records** options then you don’t need to use a **For Each** card. The streaming option will stream (send) records to a helper flow automatically.

This is a good place to learn more [about data streaming with action cards](https://help.okta.com/wf/en-us/Content/Topics/Workflows/learn/about-streaming.htm).

Let’s go back to our example. We will use the same card, **List Users with Filter**.

Before you enable the streaming options, set the card options to **First 200 Matching Records**. It will help you test and setup inputs for the helper flow.

[![When testing – set options to First 200 Matching Records](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_options-1.png?w=494)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_foreach_options-1.png)
<figcaption>When testing – set options to First 200 Matching Records</figcaption>

With **Status** set to **DEPROVISIONED** :

[![Listing deprovisioned users](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test.png?w=498)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test.png)
<figcaption>Listing deprovisioned users</figcaption>

Click to test the card and expand one the list items. On the left side you will the **User** JSON object (shown as **root** ) that will be passed to the helper flow. All the properties will be available to the helper flow.

[![Testing the List Users with Filter card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test_result.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test_result.png)
<figcaption>Testing the List Users with Filter card</figcaption>

Now that you know how the JSON looks, you can setup the helper flow inputs.

### Finishing up the helper flow

Going back to the helper flow, you define the inputs.

**Record** is the current item and for this particular flow you are passing in **ID** and **Email**. These values are available because they are part of the JSON object (above).

[![Helper flow inputs connected to another card](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_inputs.png?w=951)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_inputs.png)
<figcaption>Helper flow inputs connected to another card</figcaption>

And what about **Admin email** – where is this value coming from? Under **State** you can pass any additional values to the helper flow. Let’s finish setting up the main flow and you will see how to pass in **Admin email**.

### Finishing up the main flow

To finish the main flow, go back to **Options** and choose **Stream Matching Records** :

[![Setting Stream Matching Records option](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_stream_options2.png?w=494)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_stream_options2.png)
<figcaption>Setting Stream Matching Records option</figcaption>

Next choose the helper flow. Because of how steaming works, the helper flow inputs are not displayed as the entire object is sent to the helper.

[![Create an additional value to pass to the helper flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_streaming-1.png?w=496)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_streaming-1.png)
<figcaption>Create an additional value to pass to the helper flow</figcaption>

To pass the additional value ( **Admin email** ), click to create a new field inside the orange rectangle.

The name of the field ( **Admin email** ) and type ( **Text** ) have to match exactly the name and typeof the field in helper flow ( **Admin email** , **Text** ). You can pass more than one value this way.

[![Passing additional value to helper flow (Admin email)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_state.png?w=466)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_state.png)
<figcaption>Passing additional value to helper flow (Admin email)</figcaption>

Now everything is ready to run the flows.

Below is a screenshot running the main flow. Notice that under **Results** it shows the number of records streamed to the helper flow:

[![Testing a main flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test_main.png?w=710)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test_main.png)
<figcaption>Testing a main flow</figcaption>

And is a helper flow run (total 3 runs):

[![Running a helper flow](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test_helper.png?w=997)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_test_helper.png)
<figcaption>Running a helper flow</figcaption>

This is how the flows look together:

[![Main flow and helper flow overview](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_overview.png?w=1024)](https://katzmax.files.wordpress.com/2022/08/workflows_howto_helperflow_streaming_overview.png)
<figcaption>Main flow and helper flow overview</figcaption>

## Summary

In this blog post you learned how to setup a helper flow with a **For Each** card and with a streaming option.

* * *

**More resources to help you learn** :

📺 Short how-to [Workflows videos](https://youtube.com/playlist?list=PLIid085fSVdvyK8F4xuk49EchBPmAVNHG) to help you become a better automation builder.

🍭 A collection of helpful [Workflows tips](https://maxkatz.net/okta-workflows-tips/).