The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Metric not firing off for 1st updated by

Nickels
Tera Expert

I have a feeling that I may be missing something simple. I am trying to create a metric that will record the first person to update an incident. I will also be creating this on other tables but am starting with incidents first. I have created a metric against the Incident table and have it watching the Updates (sys_mod_update) field, the type is set to Script Calculation. Here is the script that I wrote for the this:

var mod = current.sys_mod_count;

if (mod == '1') {

createMetric();

}

function createMetric() {

        var mi = new MetricInstance(definition, current);

        if (mi.metricExists())

        return;

        var gr = mi.getNewRecord();

        gr.value = current.sys_updated_by;

        gr.calculation_complete = true;

        gr.insert();

}

       

I have tried multiple variations of this script and not having any good results. I started looking at the metric_events business rule today, so I am not sure if I need a new business rule to get this to start or not. Any advice you can offer is appreciated.

Thanks

-Chris

1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

Metrics only work on audited fields. By default, the system does not audit records from system tables. To audit a system table, add it to the list of tables in the glide.ui.audit_deleted_tables property list.



You can also use a business rule to generate Metric's on system fields.


View solution in original post

5 REPLIES 5

Appreciate the help either way.



Thanks


-Chris