Insert or Ignore records (Import Set)

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 12:34 PM
Hi SNow community,
Having some issues trying to upload some records based on a Transform Script, if the record exists it needs to be ignored but if doesn't exist it should be created.
Note: The transform map doesn't have any coalesce field (true).
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if (action == 'insert') {
var inc = new GlideRecord('incident');
inc.addQuery('caller_id', source.u_caller_id);
inc.addQuery('category', source.u_category);
inc.addQuery('subcategory', source.u_subcategory);
inc.addQuery('impact', source.u_impact);
inc.addQuery('urgency', source.u_urgency);
inc.addQuery('priority', source.u_priority);
inc.addQuery('assignment_group', source.u_assignment_group);
inc.addQuery('short_description', source.u_short_description);
inc.query();
if(inc.next()) {
ignore = true;
}
} else {
ignore = false;
}
Thanks in forwards
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 01:03 PM
if there is no coalesce and you want to inter the record then there is no need of writing this run transform script. The transform map should auto create the record.
Regards
Vinayak