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

Metrics scripting

rezacol
Mega Expert

I want to capture the assignment group at the time of SLA breach on task table. So I am using the below code

if (current.active) {

      if (current.has_breached.getDisplayValue() == 'true') {

                createMetric();

      }

}

 

function createMetric() {

  var mi = new MetricInstance(definition, current);

  if (mi.metricExists())

      return;

 

  var gr = mi.getNewRecord();

  gr.field_value = current.task.assignment_group;

  gr.calculation_complete = true;

  gr.insert();

}

But this isn't capturing any records. Plese advice me where am i doing wrong   ?

1 ACCEPTED SOLUTION

Got the solution. I added metric event for task_sla table and now its working as per my requirement.


View solution in original post

12 REPLIES 12

Hi Charl -



You can do it via metric scripting as explained here or you can make use of Workflow to trigger when your sla breaches and store it into a custom field.



Thanks,


Reza Rahman


Hi Reza,



I am using your script. It's my first time working with Metrics. I have exact same requirement of yours. But I need the Incident assignment group. Can you tell me all the steps necessary to do it?



Thanks


Deepansh Jain
Kilo Contributor