Transform map script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 11:35 AM - edited 01-10-2025 03:41 PM
Hello,
I need help with script. I am using transform map and want to use "Use source script" option for one of the fields to :
Pull user's first and last name with specific job code (J1,J2,J3,J4,J5)
Below the field and the draft script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 11:53 AM
Hi @sparkles ,
If you are trying to fetch user's data from User[sys_user] table with some specific job code then add one more filter condition.
answer = (function transformEntry(source) {
var managerLevel = // the name of the field and the code are u_manager_level (w1,A1..)
var user = new GlideRecord("sys_user");
user.addQuery ("u_manager_level", managerLevel);
user.addQuery("job_code', '<JOB CODE>' ); // replace the job_code variable and value with actual name/value
user.query();
if(user.next()) {
return user;
}
Seems like source and target are same ( as full name not showing ). Also explain the details business case, that after fetching the first name & last name what is going to do with incoming data from source table.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 11:53 AM
I'm not sure I understand what you are trying to do. In a transform map script, you should be sending what you want the resulting field to have in it. Your script returns the user object, but you said you wanted it to be the first name, last name, and a code. Can you please clarify what you are trying to accomplish?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 03:54 AM
Hi Jennifer,
my script just to test if I can get the information (so I didn't specify anything for last/first name). I want my transform map to pull user's last name and first name with specific manager level code. For example if we have 2 user's with the same first and last name but one is admin and another is manager, I don't want both. I want only the user with manager level. Our system have 5 codes for manager level. So I am not sure how to get the result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2025 04:23 AM
When you said, I want my transform map to pull user's last name, first name, and the code you shared is pulling data from User[sys_user] table.
Based on information given, i understand that, COM Employee Code ( source table ) has some data which you want to process and update the Employee Std Code ( target ) table but you are looking for only those records ( in target to be udated ) which falls under JOB CODE category.
COM Employee Code --> Transform Map ( check the JOB CODE Record )--> Employee Std Code
Can you re-phrase the business user case in more details.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution