<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 Calculate Okta Profile Attribute Values Based on Derived Dates
Okta Classic Engine
Okta Identity Engine
Lifecycle Management
Overview

Calculating Okta profile attribute values based on derived date values, such as a hire date, requires converting the date to Unix format, adjusting the time in seconds, and converting it back to ISO8601 format. This process allows administrators to populate attributes like a secondary email address up to 14 days after a hire date or set an account end date to one year from the hire date.

Applies To
  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Expression Language
  • Profile Attributes
Solution

How are Okta profile attribute values calculated based on derived dates?

 

Calculate Okta profile attribute values based on derived date values by identifying the source date, converting it to Unix format, adjusting the time in seconds, and converting the result back to ISO8601 format.

  1. Identify the application attribute that contains the source date (for example, appuser.LastHireDate).
  2. Ensure the date is in the full ISO8601 format. If the attribute is formatted as 2021-09-20T00:00:00, append .000Z.
  3. Convert the date to Unix format using Time.fromIso8601ToUnix().
  4. Truncate the milliseconds using substring(value, 0, 10) to ensure the number fits into a 32-bit integer.
  5. Convert the value into an integer using Convert.toInt().
  6. Add or subtract the desired number of seconds. For example, add one year by adding 31536000.
  7. Convert the number back to a string and re-append the milliseconds placeholder zeros (+ "000").
  8. Convert the Unix date format back to ISO8601 using Time.fromUnixToIso8601() to reflect the date modification.

 

Review the example expression integration mapping, where the source date 2021-09-20 evaluates to 2022-09-20.

String.substring(Time.fromUnixToIso8601((Convert.toInt(String.substring(Time.fromIso8601ToUnix("2021-09-20" +"T00:00:00.000Z"),0,10)) + 31536000)+"000"),0,10)
Loading
How to Calculate Okta Profile Attribute Values Based on Derived Dates