I have a Question Regarding Transform Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:14 AM
Import Source: External data file contains employee records with name, email, department, employment type, and manager email. Conditions to Apply During Transformation: Set the user's department based on the incoming department name. If Emp_Type is "Contract", mark the user as inactive and assign the title "Contractor". If Emp_Type is "Permanent", mark the user as active and assign the title "Employee". Set the user's manager reference based on the manager's email (if present and exists in the system). in servicenow
Can anyone explain what's the exact requirement by "Set the user's manager reference based on the manager's email (if present and exists in the system). in servicenow"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:19 AM
you need to set 3 fields on target sys_user table (Active, Title & Manager) based on the incoming Emp_Type value.
It's an easy requirement.
you can use onBefore transform script for this to handle Active and Title
Manager you can have via field map
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if (source.u_emp_type == 'Contract') {
target.active = false;
target.title = 'Contractor';
} else if (source.u_emp_type == 'Permanent') {
target.active = true;
target.title = 'Employee';
}
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 03:33 AM
"Set the user's manager reference based on the manager's email (if present and exists in the system). in servicenow"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2025 08:07 PM
it means map the manager incoming value and see if it matches with any manager user in sys_user
For that you can have normal field map
I hope you are aware on how to do that.
I believe I have answered your question.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader