<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
0D54z00007fW12yCACOkta Classic EngineDirectoriesAnswered2024-03-25T21:31:05.000Z2022-05-23T10:07:00.000Z2022-05-24T15:58:55.000Z

lo7ab (lo7ab) asked a question.

Applying a Time Zone to a user profile based on Okta Expression Language

We have a few apps (namely Salesforce) that use TimeZone and Locale but we don't have either set in our source directory, Active Directory.

 

I appreciate I can add entries to AD and then map that back to Okta and have that push to my Apps but I'm looking at a way to automate this without needing to add additional fields in AD and updating all my users.

 

We only have two time zones to worry about, Europe/London and Europe/Dublin. Each users' profile already has the country set as part of "countryCode" so I was thinking we could use Expression Language to define the Time Zone based on "countryCode".

 

For example, the following would set the timezone to London unless they had a countryCode of IE:

If "countryCode" is "IE" Then

Set timezone = "Europe/Dublin""

Else

Set timezone = "Europe/London"

End If

 

In a similar vein, I would also set the locale in the same way:

If "countryCode" is "IE" Then

Set locale = "English (Ireland)"

Else

Set locale = "English (United Kingdom)

End If

 

The above would be placed in the Directory Integration for AD, under the "Okta Attribute Mappings" section for both Time Zone & Locale attributes, set to Expression.

 

Can Okta Expression Language do what I'm trying to achieve and provide some sample code that I can play with?


  • flaviu.vrinceanu1.5628408972654734E12 (Customer Success Service Delivery)

    Hi @lo7ab (lo7ab)​,

     

    Thank you for posting on the Okta Community page!

     

    I have done some research on my end and I have managed to find the bellow documentation about Okta Expression Language that contains conditional expression which may help you achieve your use case:

     

    You should be able to achieve this by using something similar as the bellow expression that I have tried to built:

    • user.countryCode == "IE" ? "English (Ireland)" : "English (United Kingdom)"

     

    If we add the above expression to a mapping for the locale attribute from Okta to AD, it should send the value "English (Ireland)" towards AD if the country code attribute has the "IE" value and if it does not contain this value therefore it should send "English (United Kingdom)".

     

    There are a few more examples in the documentation provided above along with more details about Expression Language that might help you achieve your use case.

     

    I hope the above information is helpful!

    Expand Post
This question is closed.
Loading
Applying a Time Zone to a user profile based on Okta Expression Language