Transfrorm Map - Field Map script or Transform Map script

OluseyiS3924078
Tera Contributor

I have been tasked with modifying a Transform Map. specifically one of the fields
Source field - emp-id - Managed By (alm_hardware)   .

 

i am assuming it should do some kind of  lookup on the sys_user table, where the emp-id and the employee id matches, and then populate the Managed by field with the corresponding name

i have tried using the following script.
answer = (function transformEntry(source) {
var userSysId = '';
var employeeId = source.u_emp_id; // Replace u_emp_id with your actual source column name

if (employeeId) {
var userGR = new GlideRecord('sys_user');
if (userGR.get('employee_number', employeeId)) { // Assuming employee ID is in employee_number field
userSysId = userGR.getUniqueValue();
}
}
return userSysId;
})(source);

But the managed_by field is populated with 'No details'.  Any hints on what i need to tweak in the code

0 REPLIES 0