<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

Converting a String to an Array Using Okta Expression Language

Lifecycle Management
Okta Classic Engine

Overview

Administrators convert a string into an array using the Okta Expression Language (OEL) during attribute mapping. The Okta Expression Language provides array functions that facilitate data transformation when specific operations or applications require different data types. 

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Expression Language (OEL)
  • Attribute Mapping

Solution

How does the Okta Expression Language convert a string to an array?

Combine the Arrays.toCsvString({}) and Arrays.add() functions in the Okta Expression Language to convert an empty array to a comma-separated values (CSV) string and add the specific string as an element

Arrays.add(Arrays.toCsvString({}),<string>)
  1. In this expression, replace <string> with the variable to map or specific text as per the requirements.
  2. Convert an empty array to a CSV string using the Arrays.toCsvString({}) function, and then using the Arrays.add() function to add the specific string to this array. The end result will be an array that contains the specified string as an element.
  3. The function can be expanded to include multiple values in the array from different attribute sources by enclosing the expression in another Arrays.add(arrayPlacedHere,newStringHere)expression as follows:
Arrays.add(Arrays.add(Arrays.toCsvString({}),<string>),<string2>)


Example: 

String

Loading
Okta Support - Converting a String to an Array Using Okta Expression Language