How to Write a Custom Function Program Exit involved in a Rule String that returns an XML formatted date/time in local time.

Document ID : KB000020296
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

Existing %XD% Rule String in Provisioning Templates returns an XML formatted date/time value as "yyyy-mm-ddTHH:MM:SSZ" of the current date/time instead of UTC.
The requirement is to have Rule String returning an XML formatted date as "yyyy-mm-ddTHH:MM:SSZ" of the current date/time in local time instead of UTC.
In this issue Local time is the same for IM Provisioning Server than for endpoints.

Solution:

Existing %XD% Rule String in Provisioning Templates returns an XML formatted date/time value as "yyyy-mm-ddTHH:MM:SSZ" of the current date/time in UTC.
The requirement is to have Rule String returning an XML formatted date as "yyyy-mm-ddTHH:MM:SSZ" of the current date/time in local time instead of UTC.
In this scenario the Local time is set by IM Provisioning Server clock settings and not by the endpoint servers.
For the Custom Function Program Exit;
See "Provisioning Reference Guide > Common Program Exit Reference.
This KD shows you how to build such a custom function.
From Microsoft Visual Studio 2008:
Create a new project from "Win32 Console Application" template.
Choose DLL Application Type.
See the following VC++ code performing this task.

Figure 1

Figure 2

Here are the include files used:

Figure 3

Build the dll in release mode (e.g. etarulefunctions.dll) and copy it under the provisioning server bin folder.
(e.g.: C:\Program Files (x86)\CA\Identity Manager\Provisioning Server\bin\)

Next, from IM Provisioning Manager define a Common Program Exit with Type as DLL, location of the DLL (e.g. : C:\Program Files (x86)\CA\Identity Manager\Provisioning Server\bin\etarulefunctions.dll) and Method as XLocalDate.

Figure 4

Figure 5

Here is a sample involving the Custom Function Program Exit in description field of the general tab of an ADS template. Just to illustrate.

Figure 6

Result in this sample is as following:

Figure 7