<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 Create a Custom List Filter in Workflows
Workflows
Okta Classic Engine
Okta Identity Engine
Overview

This article describes how to create a custom list filter.

Applies To
  • Okta Workflows
Solution

Let us consider the scenario of obtaining a list of all user groups in an organization that start with a particular text, such as groups beginning with No-code.

This is not the right solution, but I ran into this problem myself, so I’m sharing it here. The first thing to try is to use the List – Filter card.

Something like this:

List – Filter card   
 

But this will not work. Let us use a group name of No-code Builders for this example.

It is required to check if No-code is in No-code Builders group name. But instead, this card checks if No-Code Builders is in No-code that results in an empty list.

The solution is to use the List – Custom Filter card.

The List – Customer Filter card uses a helper flow to determine if a list item should or should not be included in the new (filtered) list.

Looking at the helper flow first, this is how it looks:

helper flow

The helper flow can contain any logic to determine if a current list time should or should not be included in a returned new list. If the helper flow returns true, the item will be added to a new list. If the flow returns false, the time will not be added to the new list.

In this example, the main flow passes two variables to the helper flow (On Demand – Helper Flow card):

  1. Group name – actual group name, such as No-code Builders
  2. Filter – text to look for in a Group name

The second card (Text – Find) takes the Filter text and searches for it in the Group name. If it finds a match, it returns its position, which will be 0 or greater. If no match is found, then it will return -1.

The next card, True/False – Expression, checks to see if the value is less than 0 and then negates it.

If a match is found (position = 0 or position > 0).

  • (position < 0) evaluates to false
  • not (position < 0) becomes true

If a match is not found (position = -1)

  • (position < 0) evaluates to true
  • not (position < 0) becomes false

The last card, the Flow Control – Return, returns true or false

  • If the return value is true, then the item should be added to the list
  • If the return value is false, then the item will not be added to the list.

The main flow calls the helper flow:

helper flow   
 

The Group name and Filter variables will be shown when specifying the helper flow.

The Group name is set to Profile.Name (click on the down arrow on the right of the field). Profile.Name is a path in a JSON group list.

helper flow   
 

The Filter is set to the text being filtered for.

After running this flow, the List – Custom Filter card will return a list containing only groups with the filter text No-code in them.

To end the guide, this is how inputs from the main flow are related to the helper flow. First, inputs are defined in the helper flow. When a helper flow is set in the main flow (Helper Flow), those inputs will be shown (Group name and Filter). 

helper flow

 

How to build a custom filter video: 

Loading
How to Create a Custom List Filter in Workflows