- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 10:15 AM
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 04:06 PM
Hi @Neha Rani4 ,
The issue you are encountering seems to be the order of execution.
Try onBefore or onAfter-
Ensuring that the field we are accessing from source are properly mapped.
Now try the below code-
(function runTransformScript(source, map, log, target) {
if (source.u_contract_num && source.u_assig_status_code && source.u_name) {
var sync_data = new GlideRecord('sn_hr_core_job');
sync_data.initialize();
sync_data.u_contract_number = source.u_contract_num;
sync_data.u_hr_status = source.u_assig_status_code;
sync_data.user = source.u_name;
sync_data.insert();
gs.info('Transform map successful for contract number: ' + source.u_contract_num);
} else {
gs.error('Source fields are undefined. Contract number: ' + source.u_contract_num);
}
})(source, map, log, target);
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 10:24 AM
Hi @Neha Rani4 ,
This code has 2 gs.info() with same message .. change it with different and test which is one executing ...
and based on output ..source.u_contract_num this is undefined, check the stage table values for this column.
gs.info('Transform map @@@ 1' +source.u_contract_num);
....
....
gs.info('Transform map @@@ 2' +source.u_contract_num);
-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
07-09-2024 10:28 AM - edited 07-09-2024 10:35 AM
Hi @AshishKM
I have checked ,first gs.info() is working but the second one is not.
and the stage value is u_contract_num is this only but still showing undefined.
Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 10:38 AM
I think it might related to application scope. Your transform map is under Global scope?? Do you see any write operation entries in application restricted caller access from Global to HR scope with 'requested' status? if yes just change the status to grant the access and try.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 04:06 PM
Hi @Neha Rani4 ,
The issue you are encountering seems to be the order of execution.
Try onBefore or onAfter-
Ensuring that the field we are accessing from source are properly mapped.
Now try the below code-
(function runTransformScript(source, map, log, target) {
if (source.u_contract_num && source.u_assig_status_code && source.u_name) {
var sync_data = new GlideRecord('sn_hr_core_job');
sync_data.initialize();
sync_data.u_contract_number = source.u_contract_num;
sync_data.u_hr_status = source.u_assig_status_code;
sync_data.user = source.u_name;
sync_data.insert();
gs.info('Transform map successful for contract number: ' + source.u_contract_num);
} else {
gs.error('Source fields are undefined. Contract number: ' + source.u_contract_num);
}
})(source, map, log, target);
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar