i am trying to import data through import set , now the records have multiple classes in it and i want that according to the class name the records should be inserted into corresponding tables so for eg. computer class should be inserted into cmdb_ci_computer , server in cmdb_ci_server, unix server in cmdb_ci_unix_sever and so on , so i have done this through transform map script ,now i also want to use the IRE engine for these records but that is not happening
transform map script- (onBefore)
(function runTransformScript(source, map, log, target /*undefined onStart*/) {
// Map class name to actual CMDB table
var classMap = {
"computer": "cmdb_ci_computer",
"server": "cmdb_ci_server",
"unix server": "cmdb_ci_unix_server",
"application software": "cmdb_ci_application_software",
"desktop software": "cmdb_ci_desktop_software",
"database": "cmdb_ci_database"
};
var inputClass = source.u_class_name.toLowerCase();
var targetTable = classMap[inputClass];
if (!targetTable) {
gs.log("Unknown class: " + source.u_class_name, "CITransform");
log.warning("Skipping unknown class: " + source.u_class_name);
ignore = true;
return;
}
// Prepare class-wise field mappings
var values = {};
if (["computer", "server", "unix server"].includes(inputClass)) {
values = {
name: source.getValue('u_ci_name'),
serial_number: source.getValue('u_serial_number'),
dns_domain: source.getValue('u_domain'),
category: source.getValue('u_category'),
disk_space: source.getValue('u_disk_space'),
ram: source.getValue('u_total_physical_memory'),
os: source.getValue('u_os'),
os_version: source.getValue('u_os_versions')
// model intentionally skipped
};
} else if (["application software", "desktop software"].includes(inputClass)) {
values = {
name: source.getValue('u_ci_name'),
category: source.getValue('u_category'),
os_version: source.getValue('u_os_versions')
};
} else if (inputClass === "database") {
values = {
name: source.getValue('u_ci_name'),
category: source.getValue('u_category'),
os_version: source.getValue('u_os_versions'),
type: source.getValue('u_type__f_')
};
}
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('ImportSet'); // Use a name that matches your IRE source rules
gs.log("Calling CMDBTransformUtil for class: " + targetTable + " with values: " + JSON.stringify(values), "CITransform");
try {
var result = cmdbUtil.identifyAndReconcile(targetTable, values);
if (!result) {
gs.log("CI not created or updated for name: " + source.u_ci_name, "CITransform");
} else {
gs.log("CI created/updated: sys_id = " + result.sys_id + " for " + source.u_ci_name, "CITransform");
}
} catch (e) {
gs.logError("Error during IRE call: " + e.message, "CITransform");
}
ignore = true;
})(source, map, log, target);
these are kind of logs im getting-