Views:

Applies To:

GroupID 9 and 10 - Synchronize

Business Scenario:

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?

Solution:

We can achieve this by using a VB script in a Synchronize job.

Steps:

  1. In GroupID Management Console, expand the Synchronize node, right-click All Jobs, and then select New Job.
  2. On the Job Template page, select the Blank Job option and click Next.
  3. Since this is an update job from AD to AD, select Microsoft Active Directory (LDAP) as the source and destination provider.
  4. 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.
  5. 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.
  6. On the Field Map(s) page, mark the EmployeeID attribute as the key attribute and click the Transform button   for the Disable Account attribute.


     
  7. On the Transform dialog box, select the Script option from the drop down list and click Edit Script.


     
  8. 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")

    Try

    If System.DateTime.Compare(retiredDateField, System.DateTime.Now) < 0 Then
    sResult = "True"

    else

    sResult = "False"

    End If

    Catch

    sResult = "False"

    End Try

    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.
     
  9. Now click  and enter a date to test the script. After successful testing, click OK.


     
  10. Finish the job wizard and run the job.
Comments (0)