- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 12:54 AM
Hello,
I've been trying to get the total number of incidents that were resolved within 15 minutes of their creation using Performance Analytics.
To do this I've written the below Script as there were no OOB filter conditions to apply in the Indicator level. Can someone guide me with the syntax and how to achieve this requirement? Thanks in advance!
var created = current.sys_created_on;
var resolved = current.resolved_at;
var diff = gs.dateDiff(created, resolved, true);
var div = diff/60;
var min = parseInt(div);
if (min < 15){
gs.info('CCCCCCCCC: '+min);
}
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:36 AM
Hi @Supreeth
Can you try the below code?
var created = current.sys_created_on;
var resolved = current.resolved_at;
var diff = gs.dateDiff(created, resolved, true);
var div = diff/60;
var min = parseInt(div);
if (min < 15){
return min;
}
Please mark the response as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:36 AM
Hi @Supreeth
Can you try the below code?
var created = current.sys_created_on;
var resolved = current.resolved_at;
var diff = gs.dateDiff(created, resolved, true);
var div = diff/60;
var min = parseInt(div);
if (min < 15){
return min;
}
Please mark the response as Helpful/Correct, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 01:51 AM
Thanks for the quick response, Nikita. I tweaked the existing OOB Script for it apply in minutes as shown below.
var diff = function(x, y) {
return y.dateNumericValue() - x.dateNumericValue();
};
var mins = function(x, y) {
return diff(x, y) / 60;
};
mins(current.sys_created_on, current.resolved_at);