How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I convert a date stored in DS to a format that the Task Scanner in IDM (All versions) can use?

Last updated Jan 12, 2023

The purpose of this article is to provide information on converting a date stored in DS to a format that the Task Scanner in IDM can use. This can be useful if you want to import the date stored in DS for inclusion in a Task Scanner process.


Converting dates

DS stores dates as a string (for example, 202012062359Z), whereas the Task Scanner expects dates in the ISO 8601 Zulu time format (for example, 2020-12-06T23:59:00.000Z).

You can convert the DS dates using a transform script similar to the following:

  1. Create a convertdate.js file in the /path/to/idm/script directory with the following contents: var ldapDate = source.dateTest; var openIdmDate = ""; openIdmDate = ldapDate.replace(/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})Z$/, "$1-$2-$3T$4:$5.00.000Z"); openIdmDate;
  2. Change the configuration of the required DS date attribute(s) in the sync.json file (located in the /path/to/idm/conf directory) to use the new transform script. This example uses an attribute called startDate: { "source" : "", "transform" : { "type" : "text/javascript", "file" : "script/convertdate.js" }, "target" : "startDate" }

You can convert the IDM date back to the DS format if you want to write the attribute back to DS using another transform script similar to the following:

ldapDate = openIdmDate.replace(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{3})Z$/, "$1$2$3$4$5")

See Also

FAQ: Task Scanner in IDM

How do I configure the Task Scanner in IDM (All versions) to find a user's start date between today and n number of days in the future?

Schedules

Related Training

N/A

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2023 ForgeRock, all rights reserved.