Time duration in metrics

Anandini
Tera Expert

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.

2 ACCEPTED SOLUTIONS

Manikanta Kota
Mega Guru

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

View solution in original post

Aditya02
Tera Guru

Hi @Anandini ,

 

You can follow these steps to get your job done:

 

  1. Navigate to Metrics Definitions:
  2. Go to Metrics > Definitions and click on Create New.
  3. 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

=====================================***********==========================================

 

View solution in original post

7 REPLIES 7

AndersBGS
Tera Patron
Tera Patron

Hi @Anandini ,

 

A better solution is to create a response SLA. here you can start the SLA when state is new and assigned to is empty. Response SLA can complete based on assigned to is not empty.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

VishaalRanS
Tera Guru

Hi @Anandini 

 

Here’s a simplified list of points to set up a metric in ServiceNow for tracking unmanaged ticket time:

  1. Create a Metric Definition:
    • Go to Performance Analytics > Metrics > Definitions.
    • Click New.
    • Name it: “Time Unmanaged Before Assignment”.
    • Set Type to Duration.
  2. Define Conditions:
    • Filter tickets by:
      • State = New
      • Assigned to is empty.
  3. Configure Metric Instance:
    • Use Sys_created_on to calculate duration until assignment.
  4. Create a Business Rule:
    • Go to System Definition > Business Rules and create a new rule.
    • Set it to run on update.
    • Condition: Assigned to changes from empty to a user.
    • Add a script to calculate unmanaged time.
  5. Create a Report:
    • Go to Reports > Create New.
    • Choose a format (e.g., bar chart or table).
  6. Test the Setup:

Create test tickets to ensure the metric captures unmanaged time correctly.

 

Thanks, and Regards

Vishaal

Please mark this response as correct or helpful if it assisted you with your question.

 

Sai Krishna6147
Mega Guru

Hi @Anandini 

To create a metric in ServiceNow that tracks how long tickets sit unmanaged (from when they are created as "New" to when they are assigned), you will need to use the Metrics feature in ServiceNow. Here’s how you can set up a Metric Definition for this specific use case:

Steps to create a metric for "New to Assigned" in ServiceNow:

  1. Go to the Metric Definitions module:
    • Navigate to Metrics > Definitions in the Application Navigator.
    • Click on New to create a new metric definition.
  2. Configure the Metric Definition:
    • Name: Provide a descriptive name like "Time Unmanaged (New to Assigned)".
    • Table: Select the table where you want this metric to apply. For example, if it's for Incident tickets, select incident.
    • Field: Select the field that represents the state of the ticket. In this case, it would be Assignment group, since you want to track when a ticket is unassigned to when it is assigned.
    • Active: Check this box to make the metric active.
  3. Set the Conditions (Start and End Conditions):
    • Start Condition: Define the condition when the metric should start recording.
      • For the Start Condition, you want the metric to start tracking when the ticket is New and unassigned. You can configure this with:
        • State is New
        • Assignment group is empty
    • End Condition: Define when the metric should stop recording.
      • For the End Condition, the tracking should stop when the ticket is assigned:
        • Assignment group is not empty
  4. Duration Calculation:
    • Select Calculate Time Spent in the metric definition. This will calculate the duration between when the ticket is created (or enters the "New" state and is unassigned) and when it is assigned to a group.
  5. Save the Metric Definition:
    • Click Submit to save the new metric.
  6. Test the Metric:
    • Create a new incident and assign it later to ensure that the metric is working. The time between the "New" state and when the ticket is assigned should be calculated and available for reporting.

Viewing the Metrics:

Once the metric is collected, you can create reports or dashboards to display how long tickets remain unassigned. This will help you track unmanaged tickets and potentially improve the efficiency of ticket handling in your process.

This setup will show you how long a ticket sits unmanaged, i.e., from its creation to the moment it gets assigned to an individual or group.

thullurishalini
Kilo Guru

Hi @Anandini

To track the time a ticket spends in the “New” state before being assigned, you can create a new Metric Definition in ServiceNow. Here are the steps:

  1. Create a Metric Definition:

    • Navigate to Metrics > Definitions.
    • Click New and fill in the details:
      • Name: Time in New State
      • Table: Incident (or your relevant table)
      • Field: State
      • Condition: State is New
  2. Create a Metric Instance Definition:

    • Navigate to Metrics > Instance Definitions.
    • Click New and fill in the details:
      • Name: Time from New to Assigned
      • Metric Definition: Time in New State
      • Start Condition: State is New
      • End Condition: State is Assigned
  3. Track and Report:

    • Use the Metric Instances to track how long tickets remain in the “New” state before being assigned.
    • Create reports or dashboards to visualize this data.
thanks 
shalini.