Report: Number of days an incident has been open (then display within days)

rody-bjerke
Giga Guru

Hi,

Is it possible to create a report showing number of days an incident has been open.

And in this format:

Number of days                   Numbe rof incidents

1                                                                                         12

2                                                                                         45

3                                                                                         10

4                                                                                         6

5                                                                                         1

more than 5                                                       5

And in this format:

Number of days                   Numbe rof incidents

1                                                                                         12

        <incident details: short_description; number;>

        <incident details: short_description; number;>

        <incident details: short_description; number;>

2                                                                                         45

        <incident details: short_description; number;>

        <incident details: short_description; number;>

3                                                                                         10

        <incident details: short_description; number;>

        <incident details: short_description; number;>

        <incident details: short_description; number;>

4                                                                                         6

        <incident details: short_description; number;>

        <incident details: short_description; number;>

        <incident details: short_description; number;>

5                                                                                         1

        <incident details: short_description; number;>

        <incident details: short_description; number;>

more than 5                                                       5

(only show number for more than 5 days)

So either or.. the first and/or second report if its possible and how.

Best regards,

4 REPLIES 4

Karthik Reddy T
Kilo Sage

Hello Rody,



Use the report type column for the first requirement.



find_real_file.png


Karthik Reddy T.
ServiceNow Commnunity MVP -2018 class.

pgrover
Giga Expert

Hi,


This displays the total number of open incidents for particular duration.




find_real_file.png


Venkateswarlu K
Mega Guru

HI Rody


Can u pls try like this



I have a Scheduled Job...


find_real_file.png



...that calls a function in a Script Include:



function u_updateAgingCategoryField() {  


  var elapsedTime = 0;  


  var aging = '';  


  var currentTimeNow = gs.nowDateTime();  


  var gr = new GlideRecord('incident');  


  gr.addEncodedQuery('u_aging_category!=>28^ORu_aging_category=');  


  gr.query();  


  while(gr.next()) {  


      elapsedTime = (gs.dateDiff(gr.opened_at, currentTimeNow, true)) /60/60/24;  


      //check to see when the item was created  


      if (elapsedTime <= 2) aging = '0_2';  


      if (elapsedTime > 2)   aging = '3_7';  


      if (elapsedTime > 7)   aging = '8_14';  


      if (elapsedTime > 14) aging = '15_21';  


      if (elapsedTime > 21) aging = '22_28';  


      if (elapsedTime > 28) aging = '>28';  


      gr.setWorkflow(false);       //skip any Business Rules  


      gr.autoSysFields(false);   //do not update system fields  


      gr.u_aging_category = aging;  


      gr.update();  


  }  


}  




Notice in the function that I am excluding incidents >28 days because we do not want to keep updating them with ">28 Days" all the time.



Now for the trick so that the Pivot Table orders the columns properly - on the Aging Category dictionary record, set the Default value to be "0_2" and the Choice field to "Dropdown without -- None --" and create some Choice entries:



find_real_file.png




Otherwise the report will sort the columns alphabetically. And so you should end up with the following report:



find_real_file.png


SanjivMeher
Kilo Patron
Kilo Patron

Hi Rody,



You can use a Bar chart as well with below settings.



find_real_file.png


find_real_file.png



Please mark this response as correct or helpful if it assisted you with your question.