Daily Snapshot of open tickets report

paulri
Tera Contributor

I would like a report that takes a daily snapshot of open tickets. Lets say a 6am in the morning it logs how many open ticket I have. Then the next day is does the same, and so on. So over time, I get to see if our backlog of open tickets is going up or down.

Has anyone done something like this?

4 REPLIES 4

Amit Gujarathi
Giga Sage

HI @paulri ,
I trust you are doing great.

Here's an example of how you can achieve this:

  1. Create a new script include:
    • Navigate to "System Definition" -> "Script Includes" -> "New".
    • Provide a name for the script include, e.g., "TicketSnapshot".
    • Add the following code to the script include:

 

var TicketSnapshot = Class.create();
TicketSnapshot.prototype = {
  initialize: function() {},

  // Method to take a snapshot of open tickets
  takeSnapshot: function() {
    var gr = new GlideRecord('incident'); // Replace 'incident' with the appropriate table name for your tickets

    gr.addQuery('state', '!=', 'closed'); // Adjust the condition to match your definition of open tickets

    gr.query();
    var count = gr.getRowCount();
    
    gs.log('Snapshot of open tickets taken at ' + new GlideDateTime().getDisplayValue() + '. Total open tickets: ' + count);
  },

  type: 'TicketSnapshot'
};

 

  1. Create a new scheduled job to execute the snapshot:
    • Navigate to "System Scheduler" -> "Scheduled Jobs" -> "New".
    • Provide a name for the scheduled job, e.g., "Daily Ticket Snapshot".
    • Set the "Run" field to "Daily".
    • Set the "Start Time" field to "06:00:00" to capture the snapshot at 6 AM.
    • In the "Script" field, enter the following code:

 

var snapshot = new TicketSnapshot();
snapshot.takeSnapshot();

 

  1. Save the scheduled job.

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



AndersBGS
Tera Patron

Hi @paulri ,

 

Please notice that the report designer is designed to only look at tickets in current state - it doesn't take any snapshots. I instead would recommend you to utilize performance analytics, as this will be able to create a daily snapshot and report view as you're looking for.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Hi there, I ma using the performance analytics tool and for my backlog reports it takes a snapshot but overtime as incidents are resolved/closed they are taken off the backlog count therefore not acting as a snap shot. I have posted a similar query in https://www.servicenow.com/community/platform-analytics-forum/snap-shot-or-point-in-time-report/td-p... 

Thanks

Hi @NicolaH ,

 

Ok, so if you are utilizing performance analytics, and you have configured the daily snapshot, what is then the issue that you encounter. According to your statement "but overtime as incidents are resolved/closed they are taken off the backlog" then this is expected behavior, as a backlog will increase / decrease over time.

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/