<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
System Status
Announcements
Announcements
Search
Search
Select Language
0D54z0000A4gwySCQQOkta Classic EngineIntegrationsAnswered2024-04-30T17:45:51.000Z2024-04-16T09:18:17.000Z2024-04-30T17:45:51.000Z

JohnP.13462 (Customer) asked a question.

if/elseif nested conditions with Okta Expression Language

So what i'm looking for is to use the Okta expressions language with multiple nested if/elseif conditions to map a specific custom attribute to an external app. So for example:

If user's primary office attribute contains AFR in Okta then populate and map with Africa in the target system

elseif user's primary office attribute contains AP in Okta then populate and map with Australia in the target system

elseif....

 

which will be like 50 conditions in the end to properly map this attribute with the correct value.

 

I have tried something like:

[String.stringContains(user.pri_office,"INT")] ? ['International'] :

[String.stringContains(user.pri_office, "AFR")] ? ['Africa'] 

etc.

 

but i get an error that the syntax is not correct.

Image is not available

 

Any help would be much appreciated.

 

John


  • Tim LaBorn (Workflows)

    @JohnP.13462 (Customer)​ -- Hi.

     

    It seems to allow nested chains. Here is an example:

     

    user.newTestAttribute == "1" ? "US" : user.newTestAttribute == "2" ? "CA" : user.newTestAttribute == "3" ? "MX" : "Not Found"

     

    newTestAttribute value of 1 2 or 3 will return US, CA, MX if its 4 or more it returns Not Found.

     

    I don't know what the max length is.. 50 is a lot. If you do run into problems you may want to look into using Workflows and a "lookup table".

    Expand Post
    Selected as Best
  • Tim LaBorn (Workflows)

    @JohnP.13462 (Customer)​ -- Hi.

     

    It seems to allow nested chains. Here is an example:

     

    user.newTestAttribute == "1" ? "US" : user.newTestAttribute == "2" ? "CA" : user.newTestAttribute == "3" ? "MX" : "Not Found"

     

    newTestAttribute value of 1 2 or 3 will return US, CA, MX if its 4 or more it returns Not Found.

     

    I don't know what the max length is.. 50 is a lot. If you do run into problems you may want to look into using Workflows and a "lookup table".

    Expand Post
    Selected as Best
  • JohnP.13462 (Customer)

    Thanks, i did write the full syntax for all cases and i can confirm it works with 50 different if/else conditions.

     

    John

This question is closed.
Loading
if/elseif nested conditions with Okta Expression Language
Okta Support Agent (Beta)

Terms of Service

Hello! I'm the Okta Support Agent (Beta), your go-to resource for questions about Okta products. Please remember for your security and privacy, do not share any Personally Identifiable Information (PII) such as passwords, IP addresses, or other details with me.

Okta Privacy Policy and Terms of Service apply