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.

Learn: How to Create a Custom List Filter in Okta Workflows

In this example, you have a list of numbers and want to filter only the numbers bigger than 300:

workflows_howto_filter_list_numbers.png (1040×1110)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:

workflows_howto_filter_list_numbers_test.png (1058×896)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:

workflows_howto_filter_list_objects1.png (1034×1106)Filtering by a department

Running this flow returns one object where the department is set to Operations:

workflows_howto_filter_list_objects1_test2.png (1062×958)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:

workflows_howto_filter_list_objects2.png (1026×916)Filtering by a number of employees

There are two items (objects) with 10 or more employees:

workflows_howto_filter_list_objects2_test.png (1054×1012)Result – filtering by a number of employees

Expanding the result:

workflows_howto_filter_list_objects2_test2.png (1458×1270)JSON result – filtering by the number of employees

In the next example, you filter by location.geo path:

workflows_howto_filter_list_objects3.png (1028×1114)Filtering by location

Result running this flow:

workflows_howto_filter_list_objects3_test.png (1060×956)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. 

 

Tags

Workflows