In a Transform, does the onAfter script execute if 'ignore' is set to true in the transform script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2011 12:52 PM
In a transform script, the 'ignore' variable is being set to true.
However, the 'onAfter' script (or event handler) is still executing.
This is unexpected according to the documentation where it says about 'ignore':
where if true causes the current import row to stop processing.
link to documentation
Is it expected that the 'onAfter' script get called if the transform script sets 'ignore' to true?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2017 11:13 AM
As Oleksiy Kosenkov mentioned, onAfter scripts will run even if the row is ignored.
I liked Dominik Simunek's suggestion to add a variable. That did work for me. That being said, I was able to check for this without adding a variable.
if you just do the following test in your onAfter script, you should be able to skip the script on ignore:
//If this row was ignored, we should ignore it onAfter as we don't need to process this
if( source.sys_import_state == "ignored"){
return;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2024 01:25 AM
Just stumbled upon the same issue and my solution to it looks like this.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if(!target.isValidRecord()) return;
// your code
})(source, map, log, target);
So if some step in before or in the transformation made your record not elligable for insert, it will not be inserted at this point yet, so it will also not be a valid record.