- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
12-30-2021 03:07 AM - edited 10-11-2022 02:33 AM
Hi All,
Hope you are doing fine.
In this tutorial, we will be looking into Metric Definition in ServiceNow.We will be looking into the following points in ServiceNow :
1. What is the Metric definition in ServiceNow
2. What is the benefit of ServiceNow Metric Definition
3. How we can create ServiceNow Metric Definition
4. ServiceNow Metric Definition demo
Let’s first try to understand what is Metric in ServiceNow
Defined metrics can track how long an audited field holds a certain value.
For instance, a metric can track how long an incident is assigned to an individual, or how long an incident is in the state Active.
Please like, follow subscribe if you like the video to get regular updates on the upcoming videos.
Regards,
Amit Gujarathi
(Technomonk)
- 10,729 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
In Metric Definition i wrote one script but created data is coping updated data because of that duration time is showing 0.
Script is:
var type = current.u_type;
if (type == 'HRIS') {
createMetric();
}
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gs.info("-&End date: " + current.getDisplayValue('sys_updated_on'));
//gr.end = new GlideDateTime(current.sys_updated_on);
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
In Metric Definition i wrote one script but created data is coping updated data because of that duration time is showing 0.
Script is:
var type = current.u_type;
if (type == 'HRIS') {
createMetric();
}
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gs.info("-&End date: " + current.getDisplayValue('sys_updated_on'));
//gr.end = new GlideDateTime(current.sys_updated_on);
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi, is it possible to dive into sub records?
For example, I want to calculate the difference between an alert creation and the associated incident assignation.
Is it possible?
Thanks.