- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 05:08 AM
HI Community,
I have a requirement, in our instances we have HR profiles which is getting updated by the integration (zone).
In HR Profile we have field called employee class with two options E and EXT. now when the zone sends the employee class of the user as trainee , apprentice or global assignee then it needs to update as E.
How can we achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2025 03:08 AM
to use field map, you need to use field map script
like this
answer = (function transformEntry(source) {
// Add your code here
var zone = source.u_employee_class; // (u_employee_class is the field in source table)
if (zone == "T" || zone == "A" || zone == "GA") {
return "E"; // use only 1 equal to
} else
return 'EXT';
})(source);
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
05-16-2025 05:37 AM
Hi
If you have the data being imported via import set , then you can achieve it on the same transform map field map of the employee class field.
Thanks
Sai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 05:49 AM
HI @Sai62 ,
Thanks for the response
Yes we have transform map for that and we are mapping the field.
But do we need to write any script for that its because we only have 2 options in employee class in HR profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 10:56 AM
yes
You need to write the field map script as below.
if(source.zone = "trainee" || source.zone == "apprentice")
{
target.employee_class == "E";
}
Please let me know incase of any more questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 07:22 AM
Hi @suuriyas ,
As you mentioned, you're using an import set and transform map. You need to write a script to populate the Employee Class field based on the input received through the integration.
You can add this logic in the "onBefore" script of the transform map.
// Sample script
var zone = source.zone;
if (zone == "trainee" || zone == "apprentice" || zone == "global") {
target.employee_class = "E" // or backed end value of "E"
}
Please mark my answer as helful/correct if it resolves your blocker.
Thank you
Regards,
Keshav