Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Metric Definition

Narmadha PR
Tera Contributor

Hi

Please help me with my requirement:

Need to create a metric definition with the following criteria.

- Case is set to 'Resolved'.
- Case remains with the initial Assignment group and not re-assigned to another group.
- Case remains with the initial Assigned to and not re-assigned to another agent.

 

1 REPLY 1

Pavan Srivastav
ServiceNow Employee
ServiceNow Employee

Hi, Can you check this - https://www.servicenow.com/community/developer-blog/measure-what-matters-leverage-metric-instance-ta...

 

To create a new metric definition for the Case table (sn_customerservice_case or similar):
  1. Enable Metric Tracking for the Case Table (if not already enabled):
    • Navigate to System Definition > Tables.
    • Open the sn_customerservice_case table record.
    • Ensure the Metric tracking (or Extensible, depending on version) field is checked and save the record.
    • Reload the form for the changes to take effect.
  2. Navigate to Metric Definitions:
    • In the Application Navigator, type Metrics.
    • Click on Definition under the Performance Analytics or System Definition application menu (depending on your instance configuration).
  3. Create a New Metric:
    • Click the New button.
  4. Fill in the General Information:
    • Name: Give the metric a descriptive name (e.g., "Case Time in Work Notes").
    • Table: Select the appropriate case table (e.g., sn_customerservice_case).
    • Field: Choose the field you want to track changes on (e.g., state, assignment_group, or leave blank for a script calculation).
    • Type: Select the metric type, such as:
      • Field value duration: Measures how long a field holds a specific value (e.g., State is "Work in Progress").
      • Script calculation: Use a script for complex calculations (e.g., counting the number of touches or calculating duration based on specific business rules).
  5. Define Conditions (if using Field Value Duration):
    • Use the Start and End conditions to specify when the metric tracking begins and ends (e.g., Start: State is "New"; End: State is "Assigned"). The metric will automatically create records in the metric_instance table when these conditions are met.
  6. Save and Test:
    • Submit the record to save the metric definition.
    • Test the metric by making a change to a case record that meets your defined conditions.
    • Verify that an instance is created in the Metric Instances table to confirm the metric is tracking correctly.