The Zurich release has arrived! Interested in new features and functionalities? Click here for more

target.setAbortAction(true)--Default Transform Map Insert/Update Behavior

beycos
Tera Contributor

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 

4 ACCEPTED SOLUTIONS

M Iftikhar
Mega Sage

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.

View solution in original post

ChallaR
Tera Expert

@beycos  HI ,

you can try this way as well  -

Use ignore = true in the Transform Script

 

if (action == 'insert') {
ignore = true;
}

 

Thanks,

Rithika.ch

View solution in original post

@beycos 

yes that's OOTB behavior whenever you mark ignore=true in transform script

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

@beycos 

yes all records will show skipped and no insert/updates.

that's OOTB behavior.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

8 REPLIES 8

M Iftikhar
Mega Sage

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.

ChallaR
Tera Expert

@beycos  HI ,

you can try this way as well  -

Use ignore = true in the Transform Script

 

if (action == 'insert') {
ignore = true;
}

 

Thanks,

Rithika.ch

Ankur Bawiskar
Tera Patron
Tera Patron

@beycos 

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.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

beycos
Tera Contributor

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?