Report on Incident Response Time [creation to first work_notes update], how?

andy_dufresne
Tera Expert

Greetings All,

I'm tasked to capture time the response time between the Incident Create time to first worknotes created on that incident.

I'm thinking of doing this way, but

  1. Creating a new SLA Definition
  2. Under 'Start condition'I cannot find either comments/work_notes. So how do I capture this?

Am I thinking wrong? Is there a better approach for this?

Thanks a million!!

 

1 ACCEPTED SOLUTION

Sagar Patro
Kilo Guru

Andy,

I tried it myself and it works for work notes field!!!

Please verify.

find_real_file.png

Script:

// variables available
// current: GlideRecord -  target incident
// definition: GlideRecord -  (this row)
var n = current.sys_mod_count;
gs.log("inside this 1");
if (n > 0 && current.work_notes.getJournalEntry(1) != ""){
	
	gs.log("inside this 2");
	  createMetric();
}
	

function createMetric() {
  var mi = new MetricInstance(definition, current);
  if (mi.metricExists()) 
    return; 

  var gr = mi.getNewRecord();
  gr.start = current.sys_created_on;
  gr.end = current.sys_updated_on;
  gr.value = current.work_notes.getJournalEntry(1);
  gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
  gr.calculation_complete = true;
  gr.insert();
}

TEST:

find_real_file.png

 

RESULT:

 

find_real_file.png

 

Please Mark it correct and helpful if it was 🙂

 

 

View solution in original post

7 REPLIES 7

Sagar Patro
Kilo Guru

Hi Andy,

I would say, somewhere you are thinking right but you have already found out the issue with it. The SLA definitions will not have an option for comments/worknotes update.

The approach you could go for and I would recommend is using Metric Definitions.

https://docs.servicenow.com/bundle/kingston-performance-analytics-and-reporting/page/use/reporting/c...

Create a metric definition for the field "Comments and Worknotes". It would be a very simple implementation just to track the time of updating the comments/work notes. There are multiple examples present for "State" field which are simple to understand. 

Please mark this Correct and Helpful if it was. 🙂

 

Regards,

Vidyasagar

Thanks Vidyasagar, I'll give it a shot and let you know how I get along.  If there are any other alternatives too, I'm happy to try.

Sagar Patro
Kilo Guru

When I think of this, there could be multiple ways to do this using SLAs as well but it would need

1. adding a new field to incident table(maybe a true/false field) and managing it with a business rule on Incident.

2. Running a new SLA on the new field created above.

Creating a new field on tables like incident/change/problem is never recommended unless it is utmost necessary because these tables usually have a lot of data.

But the end decision would be yours.

 

Please mark this Correct and Helpful if it was. 🙂

 

andy_dufresne
Tera Expert

Vidyasagar,

 

metrics definition will have the same problem which is, the comments/work_notes are journal field they are not on the Incident table, so in the metrics definition the 'Field' column cannot be populated