<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 Update an Array Custom User Profile Attribute Using Okta Workflows

Workflows
Okta Classic Engine
Okta Identity Engine

Overview

An array custom attribute on the Okta user profile is a collection of values, which can be a list of arbitrary values or can be configured as an Enum consisting of a pre-defined list of values.  When using the Update User card in Okta Workflows to update an array attribute, the card overwrites the existing list of values with the new list of values passed to the array attribute input. 

 

When there is a need to modify an existing array attribute value, such as adding items to or removing items from the existing list, the existing list must be retrieved, updated with the desired changes, and passed back into the array attribute input on the Update User card.  

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Workflows
  • Update User card
  • Array custom user profile attribute

Solution

The examples below use a string array attribute configured as an Enum that consists of a pre-defined list of cities.

How to add items to an existing array attribute list using Okta Workflows?

To add items to an array attribute that already contains values, retrieve the current attribute value, update the list with the new values, and pass the updated list of values into the respective input on the Update User card.

NOTE: If the existing value of the array attribute is empty, attempting to add new values fails, requiring additional logic in the flow to account for this scenario.

Review the following flow configuration to add items to an array attribute that already contains values.

add items to an array attribute that is already populated

Review the execution history showing the updated list of values for the cities attribute including the new values.

execution history

How to remove items from an existing array attribute list using Okta Workflows?

Removing values from the list requires retrieving the existing list, adding logic to the flow to remove the desired values, and updating the attribute with the new list of values.

Review the following flow configuration to remove values from an existing list.

removing values from a list

Review the execution history showing the updated list of values for the cities attribute excluding Boston and Seattle.

execution history

Certain considerations apply when updating array attributes.

  • Adding the same value to the list multiple times is possible. Depending on the use case, the flow requires additional logic to check for duplicates and remove them before updating the attribute.
  • Creating a custom array attribute that is an Enum requires a Display name and a Value for the predefined values. Updating the array attribute requires the Value.
  • When attempting to update an array attribute that is an Enum, including a value in the list that is not in the pre-defined list of valid values, causes the Update User card to fail with a 400 Bad Request error:

 

Invalid value data type for property 'cities'.

 

Related References

Loading
How to Update an Array Custom User Profile Attribute Using Okta Workflows | Okta Support