<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
How to Setup a Workflows Helper Flow (with For-Each and Streaming Cards)
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

This article shows how to set up a workflow helper flow using For-Each and Streaming cards.

 

This guide helps to get started with Workflows. Okta support does not assist with custom flow construction using this guide, as it falls outside the scope of standard support. It may be necessary to adjust the flow(s) to meet specific needs. For questions, attend community office hours or post on the community forum.

Applies To
  • Okta Workflows
Solution

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

List Users with Filter  
 

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 there is a list of users, 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 the List – For Each card. The For Each card then calls a helper flow for each record in the list.
  2. The search card 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.

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

 

Using a List – For Each card

In this section, learn how to set up the main and helper flows using the List – For Each card.

  1. Setting up a helper flow
    1. 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 the On Demand – Helper Flow card:

Connected apps

Helper Flow

  1. A helper flow will have one or more inputs that 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

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

Workflows

This flow does not do much besides reading values passed to it. But that’s fine; the purpose of this blog post is to show how to set up a helper flow/main flow.

Using the Object – Get card, 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 the email is needed later in a flow.

Let’s look at the main flow.

  1. Setting up a main flow
    1. The main flow is a regular flow and will be called the helper flow. To start, use a search card that returns a list of records. The flow below uses the List Users with Filter card. The Options field is set to First 200 Matching Records:

list users with filter

list users with filter

 

  1. The list is then passed to the List – For Each card:

List – For Each

  1. Next, choose a helper flow to run for each record.

This is important. Once a helper flow is chosen, 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.

helper flow

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


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

  1. First, select the values to pass to the helper flow: User ➡ (Item, type Object):

Values

  1. Then, pass email ➡ (Email, type Text):

 

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

Workflows

  1. Running the main flow:

Workflow

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

Workflows

 

Using the Streaming Matching Records option

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

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

Helper flow

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

Create two helper flow inputs:

  • Record (type Object)
  • State (type Object)

Helper flow

  1. The record is the current item in our example User. It is being streamed (sent) to the helper flow, and all its properties should be accessible.
  2. With State, define any additional inputs to pass to the helper flow.
  3. Later, we will come back to the helper to create flow inputs. Next,  set up the main flow.

 

  1. Setting up a main flow

If a search card has a Stream Matching Records option, there is no need for 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.

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

Before enabling the streaming options, set the card options to First 200 Matching Records. It will help with testing and setting up inputs for the helper flow.

list users with filter

With Status set to DEPROVISIONED:

list users with filter

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

Details

Set up the helper flow inputs now that know how the JSON looks.

  1. Finishing up the helper flow

Going back to the helper flow, define the inputs.

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

Workflows

And what about the Admin email—where is this value coming from? Under State, pass any additional values to the helper flow. Let’s finish setting up the main flow, and then we should see how to pass in the Admin email.

  1. Finishing up the main flow

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

list users with filter

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.

list users with filter

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 type of the field in the helper flow (Admin emailText). Pass more than one value this way if needed.

list users with filter

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:

list users with filter

And is a helper flow run (total of three runs):

Helper flow

This is how the flows look together:

Workflows

 

Related References


 

Loading
How to Setup a Workflows Helper Flow (with For-Each and Streaming Cards)