To create metric definition on field type "updated By"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 12:22 PM
I am working on making a metric defination on field type "updated By" . According to below article it says "sys_updated_by aren’t monitored for metric calculations" I created a BR as the steps but still at zero.
https://tilnow.co/metrics/2015/05/30/metric-for-updated-by/
Can someone guide me on how i can get the metric instance records created for my definitions for updated_by field? If someone has implemented it would love to see script of BR / & definition.
Thanks
Tushar
Cheers..!
Happy Learning:)
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2023 02:27 PM - edited 05-11-2023 02:28 PM
Hi @eumak ,
You can create a metric definition like below
createMetric(current.sys_updated_by.toString());
function createMetric(value) {
var mi = new MetricInstance(definition, current);
var gr = mi.getNewRecord();
gr.field_value = value;
gr.calculation_complete = true;
gr.insert();
}
Then you can a Business rule like below
Add below code in advanced tab of BR
(function executeRule(current, previous /*null when async*/) {
gs.eventQueue('metric.update', current, '[sys_updated_by]', 1, 'metric_update');
})(current, previous);
This should get metric instances created for sys_updated_by field. I got the below results
Please mark answer as helpful and correct if it resolves the issue
Thanks !!!