Entire Transform should be aborted if even one row has a error

BALAJI K R
Tera Expert

Hi,

 

Currently, when a user uploads an Excel template and submits it, we set 11 reference field values from the template. If any of these reference field values do not match the values in the reference tables, we ignore that specific row and create records for the others. However, the new requirement is to reject the entire transformation if any row contains an error. Is it possible to implement this change? If so, please provide the necessary steps and scripts.

Thanks

2 REPLIES 2

Weird
Mega Sage

Not really. The transforms are done row by row, so instead you'd have to first create a script that is run before the transformations are done and do a check for errors and then ignoring the whole thing if any errors show up.

Nicholas_Gann
Mega Guru

As Weird said, this isn't really how Transform Maps are meant to work. You can achieve this but you will need to do the heavy lifting with an onStart Transform Script, so you will need to examine the columns of interest in all rows in the import set and validate that each of them are acceptable. I can't say much more than this as I don't know how your data is structured and so how it could be validated

 

The information you will need for it is here:

https://docs.servicenow.com/bundle/washingtondc-integrate-applications/page/script/server-scripting/...

 

You will need two objects from the onStart list:

import_set - To reference back to the data you need to examine in the staging table. This has two things you need, the link to the staging table (contained in the table_name attribute) and the Import Set itself will be used to filter down the information in the staging table to only the data related to the import

ignore - You set this to true when you have bad data in your data set. This will abort the transform