The CreatorCon Call for Content is officially open! Get started here.

Gathering Historic Data for Defined Metrics

Nic Nagtzaam
Mega Guru

Hi All,

 

I am trying to gather Historic data for two metrics I've just defined.

 

As an example I am looking to measure the mean time to resolve requested items based on the state field being set to closed:

 

var s = current.state;
if (s == 3)
  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.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
  gr.calculation_complete = true;
  gr.insert();
}

 

Is there any possible way for me to capture the historic data for this metric so I can have meaningful data in the report ASAP?

 

Regards,

Nic

1 REPLY 1

Dr Atul G- LNG
Tera Patron
Tera Patron

I think PA is best option to get this results. @Nic Nagtzaam 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************