- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 10:39 AM
Hello All,
I have a field value Metric Definition which captures Assigned to value. I would also like to capture the Assigned Group in the value field when the Assigned to field changes. How do I do that? Please suggest.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 04:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2015 07:58 AM
Michael, that is what I am trying to use right now. Below is the code inside the Metric Definition.
But this does not seems to work
if(current.assigned_to.changes())
{
var metricSysID = '98053f806f070e0074e990754b3ee4a3';
var instanceRecord= new GlideRecord('metric_instance');
instanceRecord.addQuery('id',current.sys_id);
instanceRecord.addQuery('definition',metricSysID);
instanceRecord.addQuery('calculation_complete','false');
instanceRecord.query();
if(!instanceRecord.next())
{
insertMetrics();
}
else
{
instanceRecord.end =gs.nowDateTime();
instanceRecord.calculation_complete = true;
instanceRecord.update();
insertMetrics();
}
}
function insertMetrics()
{
var instanceRecord= new GlideRecord('metric_instance');
var metricSysID = '98053f806f070e0074e990754b3ee4a3'; //replace the sys id of the metric definition
instanceRecord.initialize();
instanceRecord.definition = metricSysID;
instanceRecord.start = gs.nowDateTime();
instanceRecord.id = current.sys_id;
instanceRecord.value = current.assigned_to+ ' '+current.assignment_group; //replace the fieldname here
instanceRecord.calculation_complete = false;
instanceRecord.insert();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2022 01:11 AM
Hi
Can you please help me with below query
We need to calucate knowledge Article Approval duration only when the state is in review state
calculate the total time in days and hours that a knowledge article version is in the state ''review''
Thanks,
Anusha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 02:47 PM
Hey all,
I actually got this to be working by removing the current.assigned_to.changes().
Now the issue is, I need the metrics to create new record only if the assigned group is a particular group.
I tried adding if(current.assignment_group.getDisplayValue() == 'My assigned group' || current.assignment_group.getDisplayValue() == 'My assigned group2' ) but that again stopped the metrics from working.
What am I missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 03:54 PM
You can only use current in Metric, not .changes() unfortunately. Did you try by sys_id? current.assignment_group == 'sys_id here';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2015 03:59 PM
I tried using sys_id if(current.assignment_group == 'sys_id') as well Michael but did not work
