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 08:26 AM
Hi,
Are you using the custom work notes field?
If you are using existing work notes the backend value is work_notes
If I have answered your question, please mark my response as correct and helpful.
Thanks,
Sriram

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 08:29 AM
When you create an import set table it creates the fields with u_ in front of the fields. However I am curious as to why you are using a script instead of just a text field?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 08:50 AM
Hi,
Field map script may not work. You need to have an onBefore() script in place to make this work. Remove the field mapping & try below onBefore() script.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var inciworknotes;
var inci = new GlideRecord('incident');
inci.addQuery('number', source.number);
inci.query();
if (inci.next) {
inciworknotes = source.u_worknotes;
target.work_notes = inciworknotes.toString();
}
})(source, map, log, target);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2020 08:55 AM
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
target.work_notes = source.u_work_notes.toString();
})(source, map, log, target);