<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
Okta Classic Engine
Okta Identity Engine
Workflows
Overview

An array custom attribute on the Okta user profile is 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, like any other user profile attribute, the existing list of values will be overwritten with the new list of values passed to the array attribute input on the card.

 

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.  This article provides one approach for addressing this use case.

Applies To
  • Okta Workflows
  • Update User card
  • Array Custom Okta 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 that can be included in the list.  This is one possible approach for adding and removing values to and from an existing array attribute.

 

Add to Existing List

To add items to an array attribute that is already populated with values, it is necessary to first retrieve the current attribute value and update the list with the new values, then pass the updated list of values into the respective input on the Update User card.  Also, note that if the existing value of the array attribute is empty, attempting to add new values to it will fail, so additional logic must be added to the flow to account for this scenario:

add items to an array attribute that is already populated

When the flow is executed, the execution history shows that the existing list of values for the cities attribute was updated to include the new values:

execution history

 

Remove from Existing List

Similar to updating an existing array attribute to include additional values, removing values from the list requires retrieving the existing list and adding logic to the flow to remove the desired values, then updating the attribute with the new list of values:

removing values from a list

When the flow is executed, the execution history shows that the list of values for the cities attribute was updated, so Boston and Seattle are no longer included in the list:

execution history

 

Considerations

  • It is possible to add the same value to the list multiple times.  Depending on the use case, the flow may need additional logic to check for this and remove duplicates before updating the attribute.
  • When creating a custom array attribute that is an Enum, the pre-defined values must be given a Display name and a Value.  The Value must be used when updating the array attribute.
  • When attempting to update an array attribute that is an Enum, if a value is included in the list that is not in the pre-defined list of valid values, the Update User card will 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