Transform Map Coalesce field validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 08:43 PM
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?
for the highlighted fields.
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 08:49 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 09:10 PM - edited 09-04-2024 09:16 PM
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);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 09:37 PM
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.