Need to check coalesce on multiple fields separately in a transform map.

mkhan123
Kilo Contributor

We import CIs into ServiceNow. In a transform map, I have coalesce on 4 fields - name, asset_tag, serial_number and company.

As per ServiceNow documentation, if a matching value is found for one of the coalescing fields but not on the other, a new record is inserted.

However, in my case, I want name, asset_tag and serial_number fields to be unique. The only case these 3 fields can be same is if they belong to different companies. For example, if it finds a matching name and asset_tag but a non-matching serial_number for a particular company, I don't want it to insert a new record. Instead, I want to ignore such rows.

6 REPLIES 6

If the link Chuck provided doesn't help, I'm not sure...



The expected behavior for multiple coalesce fields is that ALL must match for an update, otherwise insert.


The only time it would ignore a record in the input stream is if there were no fields to update (meaning they were all the same between target and source).



Otherwise, you have to code your own "ignore" rules:


ignore = true;



If you have that line in your script, then it will ignore the current row.



-Rob


I have the same problem as Mohd described:


"if a matching value is found for one of the coalescing fields but not on the other coalesce fields, a new record is inserted and I think that's the expected behavior and there's no need to correct any documentation.


My requirement is that it should check 3 of the coalesce fields before inserting, if it don't find any of the 3 matching fields, then it should insert the record."



I think this worked before but when running on Istanbul it doesn't work any more.