Issue in updating value of Metric instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 12:22 AM
Hi All,
I have a scenario for Metric definitions where in metric definition script it checks if record is existing or not and if record exists it should update the new value of that particular field into the existing metric instance value instead of creating a new record in instance table. I have tried the following script but it is not updating metric instance values. Hope some body can help me out with this.
(function evaluateMetric(current, definition) {
var grMetric = new GlideRecord('metric_instance');
grMetric.addQuery('id', current.getUniqueValue());
grMetric.addQuery('definition', definition.getUniqueValue());
grMetric.query();
if (grMetric.next()) {
grMetric.field_value = current.getValue('assignment_group');
grMetric.value = current.getDisplayValue('assignment_group');
grMetric.update();
}
})(current, definition);
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 02:00 AM
Probably BR: metrics instance - set display value prevents updating the display value.
Try adding: grMetric.setWorkflow(false); before the update.