GroupID 9 and 10 - Synchronize
We have an HR database that stores users’ information along with their resignation and termination dates. Further, we have a Synchronize job that populates a custom attribute, extensionAttribute6, with resignation and termination dates. Is there any procedure to disable the resigned and terminated users by using the date in extensionAttribute6?
We can achieve this by using a VB script in a Synchronize job.
- In GroupID Management Console, expand the Synchronize node, right-click All Jobs, and then select New Job.
- On the Job Template page, select the Blank Job option and click Next.
- Since this is an update job from AD to AD, select Microsoft Active Directory (LDAP) as the source and destination provider.
- On the Sync Object Options page, select the required object type and then the Skip option button for it, since this is an update job.
- On the Select Fields page, select the fields you want to update. I selected EmployeeID as the key attribute and Disable Account as the target attribute.
- On the Field Map(s) page, mark the EmployeeID attribute as the key attribute and click the Transform button for the Disable Account attribute.
- On the Transform dialog box, select the Script option from the drop down list and click Edit Script.
- Now copy the following script and paste it into the Script Editor – Visual Basic.Net.
Dim sResult As String
Dim retiredDateField As String
retiredDateField = DTM.Source("extensionAttribute6")
If System.DateTime.Compare(retiredDateField, System.DateTime.Now) < 0 Then
sResult = "True"
sResult = "False"
sResult = "False"
DTM.Result = sResult
This script retrieves the value saved in the extensionAttribute6 attribute and compares it with the current date. If the resultant value is less than zero, it means that the date in extensionAttribute6 is earlier than the current date; so it will pass True as value to the Disable Account attribute. Else, it will pass the value, False.
- Now click and enter a date to test the script. After successful testing, click OK.
- Finish the job wizard and run the job.