Breakdown Mapping for Hour of Day PA reporting

RRolling
Tera Guru

Im so close I can feel it!

but I still need some help. I created widget called 'Daily Service Desk Per Hour'

find_real_file.png

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.

find_real_file.png

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:
find_real_file.png

Breakdown:
find_real_file.png

 

Any help on why the widget doesn't show the correct incidents within the hours of the day?

12 REPLIES 12

Adam Stout
ServiceNow Employee
ServiceNow Employee

I haven't tested this, but you need something that gets the local time.  

current.opened_at.getLocalTime().getByFormat('H');

No dice. Comes back with No Data on the widget.

Adam Stout
ServiceNow Employee
ServiceNow Employee

I always forget what is an object and is not, we may need to force this to an GlideDataTime.

current.opened_at.getGlideObject().getLocalTime().getByFormat('H');

If that doesn't work, we can force it:

new GlideDateTime(current.opened_at).getLocalTime().getByFormat('H');

Both lines when the job runs results in no errors but the Widget still show "No data to display" when refreshed.

 

Also, thanks for the help.

Adam Stout
ServiceNow Employee
ServiceNow Employee

I tested this one

new GlideDateTime(current.opened_at).getLocalTime().getByFormat('H');

and it did work, but scripts do not work on real-time indicators.  I was reminded of this because I was viewing one and the results were always empty.  when I looked at yesterday (after recollecting for it), I saw the expected results in the timezone for my job.