- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 10:01 PM
adding a new metrics instance definition type. Use case is a "new" created ticket time spent from the point its new and unassigned to "Assign to."
Help show how long tickets sit unmanaged.
Solved! Go to Solution.
- 2,976 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 04:34 AM
Hi @Anandini ,
You can Create SLA for the above mentioned.
Should my answer prove to be helpful, kindly mark it as such by clicking "Accept as Solution" and "Helpful."
regards,
Manikanta. Kota
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 02:21 AM
Hi @Anandini ,
You can follow these steps to get your job done:
- Navigate to Metrics Definitions:
- Go to Metrics > Definitions and click on Create New.
- Set Up the Metric Definition:
- Name: Provide a name for the metric.
- Table: Select Incident.
- Field: Choose Assigned to.
- Type: Select Script Calculation.
Script Calculation: Use the following script to create the metric:
var AssignedTo = current.assigned_to;
if (AssignedTo != '')
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
This script checks if the Assigned to field is not empty and then creates a metric instance,
calculating the duration from when the incident was created to when it was updated.
===================================***************=========================================
"If you found my answer helpful, please give it a like and mark it as the accepted solution. It helps others find the solution more easily and supports the community!"
Thanks & Regards,
Aditya
=====================================***********==========================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2024 04:34 AM
Hi @Anandini ,
You can Create SLA for the above mentioned.
Should my answer prove to be helpful, kindly mark it as such by clicking "Accept as Solution" and "Helpful."
regards,
Manikanta. Kota
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 02:21 AM
Hi @Anandini ,
You can follow these steps to get your job done:
- Navigate to Metrics Definitions:
- Go to Metrics > Definitions and click on Create New.
- Set Up the Metric Definition:
- Name: Provide a name for the metric.
- Table: Select Incident.
- Field: Choose Assigned to.
- Type: Select Script Calculation.
Script Calculation: Use the following script to create the metric:
var AssignedTo = current.assigned_to;
if (AssignedTo != '')
createMetric();
function createMetric() {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
This script checks if the Assigned to field is not empty and then creates a metric instance,
calculating the duration from when the incident was created to when it was updated.
===================================***************=========================================
"If you found my answer helpful, please give it a like and mark it as the accepted solution. It helps others find the solution more easily and supports the community!"
Thanks & Regards,
Aditya
=====================================***********==========================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 11:29 PM
Hi @Anandini
Steps to create a metric for 'New to Assigned' in ServiceNow:
- Go to the Metric Definitions module
- Configure the Metric Definition
- Set the Conditions (Start and End Conditions).
- Duration Calculation.
- Save the Metric Definition:
- Test the Metric: