<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
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.

/help/servlet/rtaImage?refid=0EM4z000008hRJD

 

Any help would be much appreciated.

 

John


  • TimL.58332 (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
  • TimL.58332 (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