- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 01:36 AM
Hi all,
I am facing an issue while running a transform map script (on complete) I want to transform a large excel file in which I want to count all the record via number with each record respectively with their sys_id.
Code ://
(function runTransformScript(source, map, log, target /* GlideRecord */) {
// Your transformation logic here
// After your transformation logic is complete and you want to insert the record
if (target) {
var newRecord = new GlideRecord('your_target_table');
// Set the fields on the new record as needed
newRecord.field1 = target.field1;
newRecord.field2 = target.field2;
// ... (set other fields)
// Insert the new record
var newSysId = newRecord.insert();
if (newSysId) {
log.info('New record inserted with sys_id: ' + newSysId);
// You can use newSysId in subsequent processing if needed
} else {
log.error('Failed to insert new record');
}
}
})(source, map, log, target);
I still unable to get response on Import logs!!
Everything consider as a help.
Regards,
Suyash
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:15 PM
You can add below line in transform script to add the comment in import row
source.sys_import_state_comment = "Row Transform succcesfull" ; //Comment in Import Row
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:15 PM
You can add below line in transform script to add the comment in import row
source.sys_import_state_comment = "Row Transform succcesfull" ; //Comment in Import Row
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:56 PM
Transform map script (onComplete)- should not run with comment
Run script of the same interface run successfully.
Thank You for the best help I searched many time but not get anything.
Thanks and Regards
Suyash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 11:59 PM
Glad to know that my response helped. Please mark response helpful as well.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP