- 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 08:46 PM
Hi @Community Alums
I have tried the approach you suggested but still facing the same issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 05:59 AM
Hi @Neha Rani4 ,
It looks like the mappings are not proper. can you please review it once and if possible share it here. Source and target, both should have the fields that you are using.
Also check the application scopes, if both are in same scope.
Try adding few logs in the script and check what all data is flowing.
Thanks,
Sanjay Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2024 01:36 AM
The Mapping was correct...It was just I need to change the event from onStart to onBefore.It is working now.
Thanks alot.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2024 08:25 AM
That's amazing...!!
Regards,
Sanjay