Metric definition for sys_updated_by

ddhaene
Kilo Contributor

I can't figure out why the metric does not create an instance if I am "watching" sys_updated_by or sys_mod_count. Has anyone else had a problem like that?

 

I have one metric definition that is a script calculation and another setup as a field value duration. I tried using sys_updated_by in the field value calculation and didn't "catch" anything. I also tried using sys_mod_count in the field value calculation and got no love.

That makes me wonder if these fields are really eligible for this kind activity. I looked at the "First Call Resolution" metric definition. It uses if (current.sys_mod_count == 0) { in the script and that seems to work no problem. That makes me wonder if I even have a clue how metrics really work. I have read and followed the wiki article

Metric Definition Support - ServiceNow Wiki

 

Ultimately, I am trying to get a count of tickets that the Service Desk folks "handle" without getting credit. We can run reports on sys_updated_by but that doesn't help if the ticket has been worked and closed by someone else. So, I'm thinking a metric would help me capture this information as it changes.

 

Any ideas? Any comments?

12 REPLIES 12

Hi Pratt,



Field duration metrics will work in event driven basis in service now. For every change in the filed value there would be an respective event created through OOB Business rule. OOB fields like sys_ fields this event creation is stopped intentionally, so to get the metric instance to be triggered in this scenario we need to fire the event through our custom code.



1) Create a metric definition(field duration on sys_updated_by)


2) Trigger the mentioned event from new BR.



All set.Metric instance will triggered for every update so that we can report on all updates to the ticket using OOB database view or metric_instance table.



Thanks


srinivas


Hi Srinivas,



Good Day!



I tried to follow your instruction but still, the metrics I did, didn't work at all. Apologies, but I am a newbie also here



Here is what I did.



1. Create business rule.


Table: Incident


When to Run: After    


Checkbox:   Insert/Update


Filter Condition: None



Advanced:


var gru =   new GlideScriptRecordUtil.get(current)


var fieldsChanged = gru.getChangedFieldNames();


gs.eventQueue('metric.update', current, '[sys_updated_by]',1, 'metric_update');



2.Create Metric



Table: Incident


Field: Updated by


Type: Field Value Duration




But still didn't work. Appreciate your help.


Many thanks in Advance.


Hi Srinivas,



I am working on similar requirement. When I tested on my personal dev instance it worked fine. However, similar business rule when I deployed on our test instance, the metric instance records are having incorrect start value. It is not picking the updated on date as start value. I have verified MetriceInstance Script Include , nothing seems to be different. Could you help to point in my right direction on how to troubleshoot this