Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Script for breakdown mapping not working

venori26
Tera Contributor

I am trying to group certain elements based on a condition.

 

Table: cmdb_ci

Field: Class

 

Condition:

 

If data in Class starts with 'Computer' then 'Hardware'

If data in Class starts with 'Windows' then 'Software'

else 'Other'

 

Script & Error:

Error during JavaScript evaluation: Not all references of "current" are passed in by "arguments" script:

var getCIGroup = function(ciClassValue) {
var type = 'Other';

if (!ciClassValue)
return 'No CI Linked';

var cleanValue = ciClassValue.trim().toLowerCase();

if (cleanValue.indexOf('computer') === 0) {
type = 'Hardware';
} else if (cleanValue.indexOf('windows') === 0) {
type = 'Software';
}

return type;
};

var result = function(current) {
if (!current.cmdb_ci) {
return 'No CI Linked';
}

var ci = new GlideRecord('cmdb_ci');
if (ci.get(current.cmdb_ci.toString())) {
return getCIGroup(ci.Class + '');
} else {
return 'CI Not Found';
}
};

result(current);

0 REPLIES 0