Okta Workflows how-to guides are questions and answers from weekly community office hours, MacAdmins Workflows Slack channel, and other places. Read all other how-to guides.
On to the question.
What are the differences between three List functions: For Each, Map, and Reduce?
The List function has three cards to iterate over a list:
- For Each – processes each item in a list with a helper flow. Helper flow doesn’t return a value
- Map – processes each item in a list with a helper flow. Creates a new list with modified items. A new list is returned to the main flow
- Reduce – process each item in a list with a helper flow. Reduces the list to a single value that is returned to the main flow
Let’s look at every function with an example.
List – For Each
The For Each card processes each item in the list with a helper flow.
You have a list of users and need to process each user. For example, de-provision each user, cancel their subscription, update their profile, or send them an email.
The For Each card doesn’t return output.
Here is an example.

In the screenshot above:
- Assign card sets the group ID
- List Group Members card lists all users in a group
- For Each card calls a helper flow for each user in a group. The User object is passed to the helper flow
This is the helper flow:

In the helper flow:
- Helper Flow card defines the flow input. In this example, it is the User object
- Using the Get Multiple card, you retrieve specific fields from the User object.
- Next, you process each user. For example, de-provision each user, cancel their subscription, update their profile, or send them an email. In this short example, you are displaying the values using the Compose card
In summary, the For Each card processes each item in a list with a helper flow, but doesn’t return a value back to the main flow.
Learn how to use the List – For Each card
How to Setup a Workflows Helper Flow (With For-Each and Streaming Cards)
List – Map
The Map card processes each item in the list with a helper flow. For each item in the list, the Map card adds a new value to a new list. The new list is returned to the main flow.
You have a list of users and need a new list where each user is listed as lastname.firstname.

In the screenshot above:
- Assign card sets the group ID
- List Group Members card lists all users in a group
- Map card calls a helper flow for each user in a group. The User object is passed to the helper flow
- The Map card returns a list (Last.First List). This is different from the For Each card that doesn’t return a value
- The Assign card is used to display the returned list
This is the helper flow:

In the helper flow:
- Helper Flow card defines the flow input. In this example, it is the User object
- Using the Get Multiple card, you can retrieve specific fields from the User object. In this flow, you retrieve the ID, First Name, and Last Name.
- Using the Concatenate card, you create lastname.firstname name format for each user in the list
- Each new name (lastname.firstname) is returned to the main flow. This puts the new name into a list
This screenshot shows one helper flow run:

In summary, the Map card processes each item in a list with a helper flow. Creates a new list with modified items. A new list is returned to the main flow.
Learn how to use the List – Map card
How to Iterate Over Items and Create a New List (or How to Use the List – Map Card)
List – Reduce
The Reduce card processes each item in the list with a helper flow. The card reduces the list to a single value that is returned to the main flow.

In the screenshot above:
- Assign card sets the group ID. It also sets a text variable Memo
- List Group Members card lists all users in a group
The is the helper flow:

In the helper flow:
- Helper Flow card defines the flow input. In this example, it is the User object and the required memo variable
- Using the Get Multiple card, you can retrieve specific fields from the User object. In this flow, you retrieve the Email, First Name, and Last Name.
- The Compose card, adds new user information to previous message
- The Return card, returns the newly created message that is then passed again to the helper flow (until all users are processed)
On the 1st run, memo is set to People list:
The Return card returns:
People list:
Max Katz (max.katz@okta.com)
On the 2nd run, memo is set to the above message and the Return card returns:
People list:
Max Katz (max.katz@okta.com)
Stella Green (stella.green@atko.email)
On the 3rd run, memo is set to the above message and the Return card returns:
People list:
Max Katz (max.katz@okta.com)
Stella Green (stella.green@atko.email)
Olivia Green (olivia.green@atko.email)
On the 4th run, memo is set to the above message and the Return card returns:
People list:
Max Katz (max.katz@okta.com)
Stella Green (stella.green@atko.email)
Olivia Green (olivia.green@atko.email)
Alicia Web (alicia4@atko.email)
And, on the 5th run, memo is set to the above message and the Return card returns:
People list:
Max Katz (max.katz@okta.com)
Stella Green (stella.green@atko.email)
Olivia Green (olivia.green@atko.email)
Alicia Web (alicia4@atko.email)
Jacqueline Miles (jacqueline@atko.email)
Now that the Reduce card processed all the items, it reduced the list to a single item (the combined message) and that item is returned in the Message property.

In summary, the Reduce card processes each item in a list with a helper flow. The card reduces the list to a single value that is returned to the main flow.
Learn how to use the List – Reduce card
How to Reduce a List to a Single Value, 3 Examples Using List-Reduce Workflows Card
Video
Watch a video about there three List actions.
Summary
In this blog post you learned how to use three List actions:
- For Each – processes each item in a list with a helper flow. Helper flow doesn’t return a value
- Map – processes each item in a list with a helper flow. Creates a new list with modified items. A new list is returned to the main flow
- Reduce – process each item in a list with a helper flow. Reduces the list to a single value that is returned to the main flow
More resources to help you learn:
🗂 Join the weekly community office hours to get help
📺 Short how-to Workflows videos to help you become a better automation builder.
🍿 A collection of helpful Workflows tips.
Leave a Reply