Capture hr service, transffered to, transffered from in Metric defination
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2023 12:42 AM
Hi All,
I have a requirement for HR case transfer, where i wanted to see how much time a HR case has spent in one HR service.
I have created 3 metric definitions one for Field = HR service, Transferred to and transferred from. Attaching the screenshot for reference.
Problem - I am not getting any input in metric definition, i created a new case after creating the metric definition and transferred multiple cases, multiple time. Ran lot of testing too.
Please suggest how can i achieve that?
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2023 12:47 AM
Hi @Prateek07 ,
hope u have created a Business rule on those tables as well which will help create a metric instance?
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2023 12:49 AM - edited ‎10-23-2023 12:50 AM
@Danish Bhairag2 but we dont create Business rule when we create metric definition state or assignment group. Is it mandatory to have a BR to trigger a metric defination?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2023 12:59 AM
Hi @Prateek07 ,
Please check this article
Also I have provided u the business rule in this post itself.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2023 01:01 AM
Business Rule
When: after
Insert: true
Update: true
delete: true
queueMetricUpdate();
function queueMetricUpdate() {
var gru = new GlideScriptRecordUtil.get(current);
var fieldsChanged = gru.getChangedFieldNames();
var gr = getDefinitions(fieldsChanged);
fields = '';
while (gr.next())
fields += gr.field + ',';
if (fields.length > 0) {
fields = '[' + fields.substring(0, fields.length - 1) + ']';
gs.eventQueue('metric.update', current, fields, current.sys_mod_count, 'metric_update');
}
}
function getDefinitions(fields) {
var gr = new GlideAggregate('metric_definition');
gr.addActiveQuery();
var tables = GlideDBObjectManager.getTables(current.getTableName());
gr.addQuery('table', tables);
gr.addQuery('field', fields);
gr.groupBy('field');
gr.query();
return gr;
}
Thanks,
Danish