Okta Workflows How-To: Filter a List with the List Filter Card
Okta Workflows is a no-code platform for automating identity processes.
This blog post is based on a question asked during office hours or the #okta-workflows channel in MacAdmins Slack: How to filter a list with the List Filter card?
Getting started
The Okta – List Filter card allows to filter a list to include only those items that meet a specified condition.
In this example, you have a list of numbers and want to filter only the numbers bigger than 300:
Using a filter with a number list
- The List Card card creates a number list
- Using the List Filter card, filter or return only values that meet a certain condition. In this example, the operator field is set to greater than or equal. The comparison value is 300. You are looking for numbers bigger or equal to 300
- The path is empty in this example. You will use the path in the next example
Result running this flow returns numbers greater or equal to 300:
Returning numbers greater or equal to 300
The next examples use this list of objects:
[ { "name": "James", "department": "HR", "employees": 10, "location": { "geo": "North America" } }, { "name": "Ali", "department": "Operations", "employees": 20, "location": { "geo": "North America" } }, { "name": "Jane", "department": "Engineering", "employees": 20, "location": { "geo": "South America" } } ]
The List Construct card creates the list. As this list has objects, the List Filter card specifies the path field. The path field indicates where to search for the condition.
In this example, you are searching for a department set to Operations:
Filtering by a department
Running this flow returns one object where the department is set to Operations:
Result – filtering by a department
In the next example, setting the path to employees, you are filtering by all departments that have 10 or more employees:
Filtering by a number of employees
There are two items (objects) with 10 or more employees:
Result – filtering by a number of employees
Expanding the result:
JSON result – filtering by the number of employees
In the next example, you filter by location.geo path:
Filtering by location
Result running this flow:
Result – filtering by location
Get your Workflows questions answered
Do you have a question about Okta Workflows? Not sure how to build a flow? Join the weekly community office hours to get help.