Issue with coalesce a reference field

Abilash Vangara
Mega Expert


Hello,

I am facing an issue with the transform map while loading data. The source field(contains a string name) is mapped to the target field(reference) and coalesce is set on this field map. Though an exact match is found the records are inserted instead of updating.

The coalesce is set to 3 fields, the other 2 field coalesce works fine when I tried coalescing only 2 of them...

Also tried putting the reference field name on the field map though the name field is the display value of that table...

Any thoughts would be greatly appreciated...

Thanks in Advance,

Abilash

6 REPLIES 6

One of the coalesce field was referring to "cmdb_ci" table so the source tried to match on the base table and the other 2 coalesce fields didn't match on the random record selected by the system, I've change the reference to the specific child table(cmdb_ci_computer) which extends the cmdb_ci and happens to be working now... 🙂



Thanks everyone for your thoughts.....


Christian Ander
Mega Guru

Hi had the same issue with a transform map containing two coalesce fields and solved it by using a Field Map script. The issue is that you have to return the sys_id when using a reference field.



Here is an example field map script



var comp = new GlideRecord('cmdb_ci_computer');


comp.addQuery('name', '=',source.u_computer);


comp.query();


if (comp.next()) {


//               gs.log("Computer " + source.u_computer + " sys_id = " + comp.sys_id);


//               log.info("Computer " + source.u_computer + " sys_id = " + comp.sys_id);


answer = comp.sys_id;


} else {


//                 log.error("Computer sys_id not found" + source.u_computer);


error = true;


}



Regards


/Christian