The CreatorCon Call for Content is officially open! Get started here.

Performance Analytics: data collector script

Community Alums
Not applicable

Trying to create an automated indicator to calculate the # of days after an incident has been breached.

I have the following configured:

1) Indicator Source (indicator source.jpg)

2) Automated Indicator (indicator.jpg)

3) Dashboard (dashboard.jpg)

I need help with the data collector script (see capture.jpg). I would like to calculate the # of days that have passed the breach time. I'm thinking the script would formulate the "breach time" (planned_end_time) minus from the current date/time (don't know how to create the variable for current system time). Can someone help me with the data collector script?

Much appreciated!

Thank you!

MIke

5 REPLIES 5

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

You are using the incident SLA database view and did not use the prefix in your field name.



days(current.taskslatable_planned_end_time, score_end);



In your job log, you should have errors, to help you troubleshoot.


Maybe the UI Action set I have posted on ServiceNow Share   earlier can help you.



Check the video starting at 2 min.


Community Alums
Not applicable

Arnoud,



Thank you. That worked. Is there a way to have breached time subtract from the current system time? I need help writing that into the data collector script.



Is this possible? What fields would I put in the automated indicator to represent the current time?


You could try if following works


var dt = new GlideDateTime();


dt.getNumericValue();



But I recommend sticking to the score_end variable check Performance Analytics script variables


score_end is the end time of the date being (or another period) you are collecting. Always using the current DateTime gives wrong results, especially if you do a historic collection.



Please mark correct if the answer is so.


Community Alums
Not applicable

Perfect. Thanks for the recommendation. I'll stick with score_end. I'll try this when I get back to my computer and mark answer correct. Thank you!