Abort transform if all rows are empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2023 04:55 PM
Hello,
I have enabled "copy empty fields" on my transform map. I know this means that all empty values will be copied on the instance.
Thus, is there a way for me to check the value of the columns first and ignore the transform if there is a column where all values are empty on the file being uploaded.
Like for example, in this file, all rows for short desc is empty. I want for the transform to be aborted if the file being loaded is like this one.
Number | Short Desc | Desc |
111 | test1 | |
222 | test2 | |
333 | test3 |
Appreciate all the help. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 12:20 AM
that's correct. it will pick the current import set for which transformation is running
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:04 AM
Thanks @Ankur Bawiskar, but unfortunately its not working, I tried printing the value of both source.sys_class_name & source.sys_import_set but its undefined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:16 AM
try using onBefore transform script and use error=true to stop entire transformation.
when the 1st row runs and onBefore runs; it will check the fields and if any 1 is empty then error=true will stop entire transformation
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 01:22 AM
Oh ok but I need to check the entire row if empty. since there are instances where the first row is empty but the second row has values.
Only when the entire row is empty then I will abort transformation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 12:22 AM
Hello @Ankur Bawiskar, was hoping you have another suggestion for me to check the entire row and abort the transformation if all rows are empty. Thanks so much.