Transform script to update records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 05:49 AM
Hi,
There are list of users imported in the u_custom_user table using excel file.
Fields are:
user_id
name
op_manager_id
hr_manager_id
hr_manager-reference to itself i.e u_custom_user table
op_manager-reference to itself i.e u_custom_user table
except manager all other details are coming from the excel sheet now I want once import is completed post import script should run to set the managers using their manager_id which is a string and it can be compared to user_id from the same table.
Also we'll check if the manager_ids are not empty and then we'll iterate through the records by comapring manager_id to user_id [As manager is also a user] in same table and get the manager values set
If the id is empty we won't run maybe?
Can anyone help with script and when onAfter or onComplete?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 10:39 PM
Thank @SanjivMeher for your response
But if we map Manager field which is reference but what if manager is imported after user in that case it would be blank right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2022 10:55 PM
I assume this is a daily sync. So a manager will always be there before a new employee is hired.
So lets say I sync today, and got all the user records...
Tomorrow a new hire joins, we do a sync, his manager should already be there from yesterday's run.
Even if it is a miss, it will be picked up in the next run.
If you think it would still left few with blank manager, I would schedule a job to query all records with blank manager and update it. Adding a transform map script to query and update for every record will slow down performance.
Please mark this response as correct or helpful if it assisted you with your question.