Script for breakdown mapping not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 12:06 AM
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);