Transform Map Coalesce field validation

Vamshi_ch123
Tera Contributor

Hi All,

 

I have a requirement to update data in the `cmdb_ci` table, specifically to set the Coalesce field to true for the "serial number", as shown in the screenshot below. The requirement is to update records only when the field values are blank, meaning if the device name is not already mapped or is null, then the record should be updated. If the field is already populated, the record should be ignored. How can I implement this validation in the Transform Map?

Vamshi_ch123_0-1725507905861.png

for the highlighted fields.

 

Thank you

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

You can add a onBefore business rule to to set ignore = true when target.name !=''


Please mark this response as correct or helpful if it assisted you with your question.

Hi @SanjivMeher 

 

same can be updated vis transform map onbefore script?

(function runTransformScript(source, map, log, target /*undefined onStart*/) {
if (target.name && target.name.trim() !== '') {
return; 
}

target.name = source.u_device_name; 
target.other_field = source.other_field;
})(source, map, log, target);

 

Something like this

 

(function runTransformScript(source, map, log, target /*undefined onStart*/) {
if (target.name=='') {
ignore = true; 
}
})(source, map, log, target);

Please mark this response as correct or helpful if it assisted you with your question.