Breakdown Mapping for Hour of Day PA reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2020 01:36 PM
Im so close I can feel it!
but I still need some help. I created widget called 'Daily Service Desk Per Hour'
The widget should show a breakdown of incidents per hour from the following day.
the issue is the incidents are not created and displayed in the correct column as you can see below.
In this example I clicked on the column for incidents opened from 11:00-12:00 but it show opened incidents from 4:00-5:00.
Widget:
Breakdown:
Any help on why the widget doesn't show the correct incidents within the hours of the day?
- Labels:
-
Dashboard
-
Performance Analytics
-
Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2020 04:51 PM
Should a function like this work:
var hour = function(){
var dateOpened = new GlideDateTime(current.opened_at);
return dateOpened.getHourOfDayLocalTime();
};
hour();
Its basically copied from the PA developer article:
https://developer.servicenow.com/dev.do#!/learn/learning-plans/orlando/servicenow_administrator/app_store_learnv2_reportanalytics_orlando_creating_breakdown_scripts_optional
Or what should I change to display it in columns?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2020 12:35 PM
I believe that will work. To be sure, add a debugging line:
var hour = function(){
var dateOpened = new GlideDateTime(current.opened_at);
gs.info(current.opened_at + ' - ' + dateOpened.getHourOfDayLocalTime());
return dateOpened.getHourOfDayLocalTime();
};
hour();
Then you can see in the logs if you are getting the right hour. For me, it worked when I collected for yesterday then look at yesterday's scores. I lost some time thinking it wasn't working when I looked at the analytics hub and it showed me the real-time scores as blank (scripts are not supported in real-time).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2021 06:11 AM
Hey Adam,
I am going through a similar issue here,
Could you help me out with the breakdown script as well?
I currently use hour of day script and its fetching me the data in UTC timezone.
current.opened_at.getByFormat('H'); //this shows all records created in last 30 days but with hour breakdown in UTC
I tried with below script as well to get data in my tz, which it ultimately does, but then i don't see more than half of the records in the report (those that were created after 16:00), which is extremely weird.
var hour = function(){
var dateOpened = new GlideDateTime(current.opened_at);
return parseInt(dateOpened.getLocalTime().getByFormat('H'));
};
hour();
//this shows me partial records created in last 30 days but with hour breakdown with correct hour in my TZ
// i do have data in my scoresheet, but not in the report