<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
Search for Users Using Contains in Workflows
Workflows
Okta Classic Engine
Okta Identity Engine

Overview

This KB will teach you how to search for users using contains in Okta Workflows.

Solution

The KB shows how to search for users, but other record types can also be searched.

Search using the ‘co’ (contains) operator

The following example shows searching for users using the co operator (contains):

 

 
Searching using the ‘co’ operator.

 

The card returns all users containing okta.com in their email attribute:

 

Searching with the ‘co’ operator.

 

Note that okta.com can be anywhere in the email string, for instance as in aaron@okta.com.email.

 

From the Okta developer docs, you can use co only the following user profile attributes:

You can only use co with these select user profile attributes: profile.firstNameprofile.lastNameprofile.email, and profile.login.

When searching for groups, the co operator supports the following attributes:

You can only use co with these select profile attributes: profile.name and profile.description

To learn more about the contains operator, refer to Okta’s API Documentation.

Search using ‘contains’ with a helper flow

We published this section as a workaround before the ‘co’ operator became available. We are keeping this section as an alternative solution and example when you need to search using other attributes.

This section will show you how to build a solution for searching for text using contains.

 

The solution has two flows:

  • List Users.
  • Search Contains_Helper.

List Users flow

 

This is the List Users flow:

 


List users' flow.

NOTE: The List Users with Search card uses the First 200 Matching Records option. This solution will not work with the Streaming option.

The flow has the following steps.

 

  1. Okta – List Users with Search card returns all the Okta users.
  2. The flow passes the users to the List—Filter Custom card. The Filter Custom card uses a helper flow to review each item in the list. The helper flow has logic to search using ‘contains’. The Filter Custom card returns a list of the items that contain the search text.

 

Search Contains_Helper flow

 

This is the helper flow.

 


A flow to search with contains.

 

The flow has the following steps.

 

  1. Helper flow. The main flow passes each User record to the Helper Flow card. The Helper Flow defines a User record Email property instead of using the Object – Get card to get a property.
  2. The flow uses the Find card to search for contains. In this example, the flow searches for okta.com text in the Email field. The Find card returns the position (0 is the first position) where the string starts or -1 if no match is found.
  3. The True/False – Expression card checks if a text is contained within another string. If the email ends with okta.com, the Expression card returns true. Otherwise, it returns false.
  4. The flow passes a true or false value from the previous card to the Return card. If the return value is true, include the current record (User) in the result list. This means the search found a match. If the return value is false, don’t include the current record in the result.

Result

 

The Okta instance has nine users. Two of them have an okta.com email address. When the flow is run, it finds two matches since two users have an email address with okta.com. The list field in the Filter Custom card holds a list with two records.

 


The list field holds the result.

Result with two records:

 


Result with two records where the email has the text okta.com.

Related References

 

 

Loading
Search for Users Using Contains in Workflows