Transform Map - Ignore Row if any fields are empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 04:03 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 04:11 AM
Hi Harry,
Have this script in the onBefore transform script
if(source.u_field1 == '' && source.u_field2 == '' && source.u_field3 == '')
{
ignore = true;
}
you will have to repeat the AND condition for all the fields you wanted to check with
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 04:14 AM
shouldn't it be || instead of && (if ANY field is empty, rather than if ALL the fields are empty?)
if(source.u_field1 == '' || source.u_field2 == '' || source.u_field3 == '')
{
ignore = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 04:20 AM
Hi Harry,
There should be an OR condition instead of AND since you want if any field is empty it should ignore.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 04:31 AM
Thank you for this, using the OR condition worked a treat. However after testing, the requirement has changed.
We would like it to ignore the whole import rather than just the individual rows, is this possible?