How to Filter a List with the List Filter Card in Okta Workflows
Last Updated:
Overview
The Okta Workflows List Filter card allows administrators to filter a list to include only items that meet a specified condition. Use the List Filter card to return specific values from a list of numbers or objects based on defined criteria.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Workflows
Solution
The following examples provide detailed how-to instructions for filtering lists of numbers, objects by specific string, objects by specific number, or a nest object using the List Filter card in Okta Workflows.
How to filter against a list of numbers with the List Filter card?
In this example, it shows how to filter a list of numbers to return only values greater than or equal to 300 by configuring the List Filter card with the appropriate operator and comparison value.
Create a number list using the List Construct card.
Add a List Filter card to return only values that meet a certain condition.
- NOTE: In this example, the operator field is set to greater than or equal to 300. The comparison value is 300. Look for numbers bigger than or equal to 300.
- Set the operator field to greater than or equal to.
- Set the comparison value to 300.
- Leave the path field empty for simple number lists.
Review the results of the flow to verify that Okta Workflows returns only numbers greater than or equal to 300.
Example JSON used for the 3 examples that follow:
[
{
"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"
}
}
]
How to filter against a list of objects by a specific string with the List Filter card?
In this example, it shows how to filter a list of objects by specifying the path field to indicate where to search for the condition, such as searching for a department set to Operations.
- Create the list of objects using the List Construct card.
- Add a List Filter card and specify the path field to indicate where to search for the condition.
- Enter department in the path field.
- Set the operator to equal to and the comparison value to Operations.
Review the flow configuration for filtering the department by Operations.
Verify that the flow returns the single object where the department is set to Operations.
How to filter against a list of objects by a numerical value with the List Filter card?
In this example, it shows how to filter the list of objects by a numerical value by setting the path to the relevant field and configuring the operator to find values greater than or equal to a specific number.
- In the List - Filter card
- Set the path field to employees.
- Set the operator to greater than or equal to.
- Set the comparison value to 10.
Review the flow configuration for filtering departments that have ten or more employees.
Verify that the flow returns the two objects with ten or more employees.
Expand the result to view the detailed object data returned by the filter.
How to filter against a list of objects by a nested path with the List Filter card?
In this example, it shows how to filter the list of objects using a nested path by specifying the parent and child keys separated by a period.
- In the List - Filter card
- Set the path field to location.geo.
- Set the operator to equal to.
- Set the comparison value to North America.
Review the flow configuration for filtering objects by the nested geographic location.
Verify that the flow returns the objects matching the specified geographic location.
