<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
0D5WR00001Iis0y0ABOkta Classic EngineAdministrationAnswered2026-02-17T16:08:40.000Z2026-02-17T02:32:48.000Z2026-02-17T16:08:39.000Z

AaronA.56027 (Customer) asked a question.

Okta profile mapping expression for adding and subtracting days, months, and years from a profile source date attribute

Recently I had a requirement to calculate Okta profile attribute values based on derived hire date values (App -> Okta). For instance, populate the secondary email address up to 14 days after the hire date or set the account end date to one year from the hire date.

 

After doing some research and trial and error I found a way to do this. Here is the process:

 

  1. Identify the app attribute that contains the source date - appuser.LastHireDate
  2. Ensure it is in the full ISO862 format - i.e. if appuser.LastHireDate is 2021-09-20T00:00:00 then append ".000Z"
  3. Convert it to Unix format - Time.fromIso8601ToUnix(=>)
  4. Truncate the milliseconds, otherwise the number will be too large to fit into a 32 bit Integer - substring(=>,0,10)
  5. Convert the value into an Integer - Convert.toInt(=>)
  6. Add or subtract the number of seconds desired (i.e. +1 year = 31536000) - => + 31536000
  7. Convert the number back to a string and re-append the milliseconds placeholder zeros - (=> + "000")
  8. Finally convert the Unix date format back to ISO862 Time.fromUnixToIso8601(=>) which should now reflect the date modification.

 

Here is an example expression integration mapping:

 

substring(Time.fromUnixToIso8601((Convert.toInt(substring(Time.fromIso8601ToUnix("2021-09-20" +"T00:00:00.000Z"),0,10)) + 31536000)+"000"),0,10)

 

where the source date "2021-09-20" evaluates to "2022-09-20"

 

Hopefully others will find this useful and avoid having to perform redundant workflow and Okta sourced profile attribute workarounds.


Loading
Okta profile mapping expression for adding and subtracting days, months, and years from a profile source date attribute