How can I report on the date an Incident was reopened?

scottatah
Giga Expert

We currently make use of the incident.reopened_count field and the Reopen Count business rule.   They essentially increment the reopen_count when the state is changed from Resolved to any other state excluding closed.

I've recently received a request to be able to report on how many incidents were reopened in a particular month.   The problem is, although I can see when a ticket was reopened via the activity log, there's no date tied to the reopening of a ticket and i'm not even sure where that would store.   How would I go about configuring the system to track and thus be able to report on this??

Thanks,
Scott

12 REPLIES 12

I've got no trouble reporting on the Incident Metrics table....and this is kinda where I thought this might go.   My issue with metrics is a lack of knowledge.   The script piece is where I struggle.   I can either implement my own or use their duration.   Any examples I've been able to find only discuss duration.



Any suggestions on how to script that portion?


In Metrics you can only use current. So previous.state isn't an option. Here's a sample Script Calculation on the State field. Maybe this will get you started. This will show all Resolved tickets. If the same ticket is resolved twice, then it was reopened once.



var s = current.state;


if (s == 6) {


      var value = current.sys_updated_by;


      createMetric(value);


}


function createMetric(value) {


      var mi = new MetricInstance(definition, current);


      var gr = mi.getNewRecord();


      gr.start = current.resolved_at;


      gr.end = current.sys_updated_on;


      gr.duration = gs.dateDiff(gr.start, gr.end);


      gr.field_value = value;


      gr.field = null;


      gr.calculation_complete = true;


      gr.insert();


}


Uncle Rob
Kilo Patron

I'd make a Metric Definition to track this, because its possible for a task to be re-opened multiple times.



It'd be way less dangerous than querying history as well.