sync Workflows

I am trying to build a Sync workflows that read a CSV file with employeeID fields and update the EmployeeNumber field.  The employeeNumber become  letter "A"+ value of employeeID

Now most of employeeID are 6 digits but some are 4 or 5 digits.  We do not want a employeeNumber of "A1234" we need to add "0"s in front if less than 6 digits so it would become A001234.

Since existing employeeId doesn't change much, I could have a script which ignore EmployeeId less than 100000 and fix them manually once  or create a script that add includes all scenarios.

I tried few thing without success.  Any help would be appreciated

Parents
  • Hi  

    Depending on the use case, and number of objects, you could instead have a mapping for employeeNumber (in AD) from a PowerShell script

    Where the script uses $employeeID = $srcObj["EmployeeID"] to retrieve the value from the current employee record, then write your code to manipulate that value to into the format and/or length you require.

    The Active Roles Synchronization Service Admin Guide has some info on accessing Source and Target objects (Active Roles 7.5.3 - Synchronization Service Administration Guide (oneidentity.com)), as screenshot below show an example where the City field from the source object is retrieved, then based on the value retrieved, a country will be set in the script, and then returned as a property value for the attribute mapping.

    So when adding your sync rules, from the source item your selecting "PowerShell Script"

    Adding your code into the script editor window (remembering to return a value)

    Then on your Target Item side, you've entering the attribute you wanted your generated value to be written to

    Hope this helps

    Stu

  • So I would have a script similar to this :

    $Prefix = "C"

    $EmployeeID = $srcObj["EmployeeID"]

    $EmployeeNumber =$($prefix)+$($EmployeeID)

    $EmployeeNumber

    I also specify to update only if employeeId si present.  Is there anyway now I can specify to update only the employee with 6-digit or more ?  I don't see a gt than in the updating rules, source is a csv file

  • Hi  

    You're setting a mapping rule, where if the value in one system is different to the other system, it will be updated. So the prevent the EmployeeID being updated if EmployeeNumber is blank, you'd need a check if your code, so look at the dstObj["EmployeeNumber"], where if its empty or null, you don't parse the EmployeeID from the file.

    In terms of ensuring the employee ID is at least 6 digits, the code provided in the communality post "Update AD users employeenumber based on csv file" gives you the logic for prefixing the the employeeID to match your desired results.

    Kind regards

    Stu

Reply
  • Hi  

    You're setting a mapping rule, where if the value in one system is different to the other system, it will be updated. So the prevent the EmployeeID being updated if EmployeeNumber is blank, you'd need a check if your code, so look at the dstObj["EmployeeNumber"], where if its empty or null, you don't parse the EmployeeID from the file.

    In terms of ensuring the employee ID is at least 6 digits, the code provided in the communality post "Update AD users employeenumber based on csv file" gives you the logic for prefixing the the employeeID to match your desired results.

    Kind regards

    Stu

Children
No Data