Create a Metric on task_sla table

Natsufab3
Kilo Guru

I want to create a metric on task_sla table. This table contains has_breached field. When ever that field is true, I want to capture the assignment group at that particular time when the SLA is breached.


I have created a metric on Task_sla table and struck up at the scripting part.

Any help is appreciated.

Thank you.

1 ACCEPTED SOLUTION

So your getting some data? Change the script to this:



if (current.has_breached == true) {


                createMetric();


      }



function createMetric() {


  var mi = new MetricInstance(definition, current);


  if (mi.metricExists())


      return;



  var gr = mi.getNewRecord();


  gr.value = current.task.assignment_group;


  gr.calculation_complete = true;


  gr.insert();


}


View solution in original post

20 REPLIES 20

Set the top of your Metric to be like this:


if (current.state == 'resolved')


      createMetric();




function createMetric() {


//then the rest of your code