How to sync between user records and hr profiles after a user record is updated from LDAP?

jordanh
Giga Contributor

We have added a new field to the user table that we also want to sync with the HR profile. I found in the hr_Utils script include where the map is that determines which fields to sync between the two but now I am having difficulties getting it to execute. I tested a script to find all the HR profiles linked to active users and then call the same method that the sync user record to hr profile business rule calls "new hr_Profile(userRec, gs).syncProfileFields()" and nothing happens. When I run a background script to change the value of the field we are attempting to sync it works though. Was hoping someone who has some experience in this area could provide some insight on how to add data to either the hr profile or user records and then sync the additional fields.

1 ACCEPTED SOLUTION

jordanh
Giga Contributor

Okay, so I was able to get the major issue I was dealing with resolved by copying and modifying one of the existing functions in the hr_Utils script include. The function syncProfileWithUser will do a one way sync from the HR Profile to the associated user record by calling the syncProfilesWithMap function which takes as parameters the source record, the destination record, a field map object presumably for fields not named the same, an array of fields to exclude and the last parameter which is a boolean and tells it whether to update the values on the destination record even if the values on the source record have not changed or to only update field values that have changed. I copied this function and named it syncUserWithProfile and swapped which record it passes as the source and destination when calling the syncProfilesWithMap function so that the user record is used as the source and the profile as the destination. I'll just need to trigger an event now to run this after a user record is changed by the LDAP import to ensure the info is sync'd.


View solution in original post

5 REPLIES 5

Any chance you can post this script?