How to populate Worknotes from a file using Transform map
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 07:56 AM
Hi All,
I am using a transform map to import the historic record from an excel sheet in to Service Now using Transform map field mappings.
I am able to populate all other fields but unable to populate the Worknotes on the form , I am using the below script in the field mapping , but it is not showing anything after running transform .
I am getting as shown below in Commentsandworknotes section
Please guide.
Target field is set as - Work notes and using the below script :
answer = (function transformEntry(source) {
var enW = source.u_work_notes.toString();
return enW; // return the value to be put into the target field
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 09:24 AM
Please guide.
var caseworknotes;
var inci = new GlideRecord('table_name');
inci.addQuery('correlation_id', source.u_historical_case_no);
inci.query();
if (inci.next) {
caseworknotes = source.u_work_notes;
target.work_notes = caseworknotes.toString();
}
})(source, map, log, target);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 09:28 AM
Couple of checks.
1. Line1
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
is missing
2.
var inci = new GlideRecord('table_name');
hope you are passing correct table name instead of table_name
3.
if (inci.next) {
has a typo. it should be
if (inci.next()) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 09:43 AM
I am using the correct table name , but I masked it here.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var caseworknotes;
var inci = new GlideRecord('table_name');
inci.addQuery('correlation_id', source.u_historical_case_no);
inci.query();
if (inci.next()) {
caseworknotes = source.u_work_notes;
target.work_notes = caseworknotes.toString();
}
})(source, map, log, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2021 01:36 PM
You've probably figured this out but in case anyone else is wondering:
You have to enable Business Rules on your transform map. Good luck!