Ignoring row in Field Map script

DhananjayM
Tera Guru

Hi,

I have a table with multiple reference fields(both reference & glde_list). In field maps script I can validate that if the said entry has a valid record in system or not. So I can have something like

answer = util.getParentSysId(source.u_refField) // This would involve checking if the refField is a valid option or not.

What I am looking out is a way where in I can ignore a row if it has invalid reference. So internally my script will return a blank or null and that will just set the reference field as null. But why I really looking for is if I can ignore the entire record. And to complicate it further my requirement is to have this logic for multiple fields on the same entity.

I have tried setting ignore = true within util.getParentSysId function, but that doesn't ignore the entire record.

Any pointers on this??

Regards,
Dhananjay

5 REPLIES 5

TJW2
Mega Guru

Are you using an onBefore Transform Script? If you set ignore = true in an onBefore Transform script, processing will stop on that row.
http://wiki.servicenow.com/?title=Transform_Map_Scripts#Mapping_with_Transformation_Event_Scripts


Its not an onBefore script, but a transform map script defined at Field Map level. This is documented in below link http://wiki.servicenow.com/index.php?title=Creating_New_Transform_Maps#Field_Map_Fields

Here we are trying to dynamically assign sys_id to a reference field via Field Map source script. And what we want is to ignore the entire record in case the value entered is invalid.

- Dhananjay


TJW2
Mega Guru

onBefore script is required to 'ignore' the source record completely. Try converting to an onBefore script. You can still use your field value source.????.


andrew_venables
ServiceNow Employee
ServiceNow Employee

Sounds like you want to use a standard field map, without the source script. If your target field is a choice list or reference field then you should see an option to set Choice Action: reject. Which according to the wiki will skip the entire row

You may also need to set the 'Referenced value field name' if the value isn't the sys_id or the display value.

http://wiki.servicenow.com/index.php?title=Creating_New_Transform_Maps#Field_Map_Fields