DBotClosedIncidentsPercentage

Data output script for populating dashboard pie graph widget with the percentage of incidents closed by DBot vs. incidents closed by analysts.

javascript · Common Scripts

Details

IDDBotClosedIncidentsPercentage
Languagejavascript
From Version5.0.0
Tagswidget

README

Populates the dashboard pie graph widget with the percentage of incidents closed by DBot vs. incidents closed by analysts.

Script Data


Name Description
Script Type javascript
Tags widget

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.

var res = executeCommand("getIncidents", {
    'query': 'status:closed and closingUser:DBot',
    'fromdate': args.from,
    'todate': args.to,
    'size': 0
});
var closedByDbot = res[0].Contents.total;

res = executeCommand("getIncidents", {
    'status': 'closed',
    'fromdate': args.from,
    'todate': args.to,
    'size': 0
});
var overallClosed = res[0].Contents.total;

var result = Math.round(closedByDbot * 100 / overallClosed);
return isNaN(result) ? 0 : result;