Transform Map - Ignore Row if any fields are empty

Harry Campbell2
Mega Guru

Hello All,

When transforming an import set table. Is it possible to ignore any rows that have an empty field?

We want to ensure that all rows to be imported have complete information. Is there a transform script I can utilize to achieve this?

I have tried just using 'Enforce Mandatory Fields' but this doesn't work, the data is still imported with empty fields.

Many Thanks

Harry

15 REPLIES 15

Hi Harry,



Have that script in onStart transform script and it will ignore entire transformation.



Regards


Ankur


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

Sorry for being a bit dense here. How do I get this to run onStart?


Ignore this - found it!


I have added this into an onStart script.



The script is no longer working, all rows are being imported.



This was working for individual rows however I wasn't using it as a transform script. I had just checked the 'Run Script' checkbox on the transform map and entered it in there.


This is the onStart script I am using:



(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {




  if(source.u_model_category == '' || source.u_manufacturer == '' || source.u_state == '' || source.u_stockroom == '' || source.u_location == '' || source.u_serial_number == '' || source.u_warranty_expiration == '' || source.u_business_unit == '' || source.u_purchased == '' || source.u_asset_tag == '' || source.u_po_number == '' || source.u_cost == '' || source.u_model == '' || source.u_vendor == '')


  {


  ignore = true;


  }




})(source, map, log, target);