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.
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Expression Language
- Profile Attributes
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.
- Identify the application attribute that contains the source date (for example,
appuser.LastHireDate). - Ensure the date is in the full ISO8601 format. If the attribute is formatted as
2021-09-20T00:00:00, append.000Z. - Convert the date to Unix format using
Time.fromIso8601ToUnix(). - Truncate the milliseconds using
substring(value, 0, 10)to ensure the number fits into a 32-bit integer. - Convert the value into an integer using
Convert.toInt(). - Add or subtract the desired number of seconds. For example, add one year by adding
31536000. - Convert the number back to a string and re-append the milliseconds placeholder zeros (
+ "000"). - 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)