- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2017 08:59 PM
Can you have a script for a breakdown mapping return multiple SYS_IDs?
I have a use case where we want to breakdown incident indicators by the affected services (calculated by the associated CI).
This data is already being collected in a custom table, but the issue is that each incident can be related to/affect multiple services.
I tried return an array of sys_ids in a breakdown mapping script, but that didn't work.
Any Ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2017 08:31 AM
Probably you need to use this hack:
Re: How to get the sys_id of the current record in an Indicator Script?
Besides I would change the script, like so:
function getImpactedServices(sys_id){
var businesServices = [];
var impactedservices = GlideRecord('task_cmdb_ci_service');
impactedservices.addQuery('task', sys_id);
impactedservices.addQuery('cmdb_ci_service.sys_class_name','cmdb_ci_service');
impactedservices.query();
while(impactedservices.next()){
businesServices.push(impactedservices.cmdb_ci_service);
}
return businesServices;
}
getImpactedServices(current.sys_id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2017 02:49 PM
Alright thanks again arnoud . Your response got me there although didn't use the workaround described in the post. I didn't realize that sys_id wasn't available. I ended up just querying by incident number:
line 4:
impactedservices.addQuery('task.number', c.number);
I also tried to change the function to take a sys_id instead of current, but I get an error about:Not all references of "current" are passed in by "arguments" script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2017 02:52 PM
Good, smart take you switched to number!