target.setAbortAction(true)--Default Transform Map Insert/Update Behavior
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hello ,
I have a script-only Transform Map in my import process. However, despite being script-only, the Transform Map still performs automatic insert and update actions on the target table, following its default behavior.
To prevent this, I am using target.setAbortAction(true); in my transform script. While this method effectively halts the default action, I suspect it may be causing some of the issues I'm currently experiencing during the import process. The error message I receive is: 'Error occurred during row insert'
My question is:
Is target.setAbortAction(true) the only supported and documented way to fully prevent the automatic insert/update behavior of Transform Maps?
Is there any alternative method, system property, or Transform Map configuration setting that disables the default insert/update logic — without having to use target.setAbortAction(true)?
Best Regards
Beyza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi @beycos,
Yes, an alternative and simpler approach for conditionally preventing actions is to use the ignore global variable in an onBefore transform script. By setting ignore = true;, you tell the transform engine to skip that row entirely, which prevents both inserts and updates without aborting the entire operation for the target record. The error you're seeing, 'Error occurred during row insert', is likely not a direct result of setAbortAction(true) but rather an issue within your custom scripting logic that is attempting to perform a manual GlideRecord insert which is failing for some reason (e.g., a business rule conflict or database-level constraint).
Hope this helps!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution and helpful so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
@beycos HI ,
you can try this way as well -
Use ignore = true in the Transform Script
if (action == 'insert') {
ignore = true;
}
Thanks,
Rithika.ch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
if you want to ignore the row then you can use onBefore transform script
Something like this based on your requirement
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(action == 'insert'){
ignore = true;
}
if(action == 'update'){
ignore = true;
}
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Thank you for your quick response. It worked now and I have a transform script that runs perfectly without any errors. It correctly performs insert and update data on the target table. However, when I check the Transform History, all the records are marked as "Ignored."
Is this expected behavior?