beingfluid
Kilo Sage
Kilo Sage

Hi Guys,

Today, I'm going to guide you through one of the small but not least feature 'Metrics'. In the next two articles we will go through creating report out of the Metric data.

Let's see first what is Metric is with the following examples :

1) A metric could measure the effectiveness of the incident resolution process by calculating how long it takes to resolve an incident.

2) It can calculate how long it takes for an approver to approve the Knowledge Article.

In Short, 'A metric measures and evaluates the effectiveness of IT service management processes'.

 

Take a look at the below example,

find_real_file.png

If you'll notice, we can see for how much duration a particular record (In this case, Knowledge Article - KB0010001) was in a particular (Draft, Review & Published) state.

Let us see how can we achieve it.

 

Step 1 : Navigate to Metrics > Definitions & Click 'New'

find_real_file.png

Step 2 : Give it a unique name

find_real_file.png

Step 3 : Select the Knowledge (kb_knowledge) table

find_real_file.png

Step 4 : Select the field as 'Workflow'

find_real_file.png

Step 5 : Select the type as 'Field value duration'

find_real_file.png

Step 6 : Paste the following script in the 'Script' and click 'Submit'

var s = current.workflow_state;
if (s == 'pending_retirement' || s == 'retired') {
answer = false;
mi.endDuration();
}

find_real_file.png

Here,

i) Setting answer to false will terminate processing of the metric. We have done this cause we want to calculate duration only or the states from draft to published.
ii) mi refers to the MetricInstance and will set the 'End' when the metrics will terminate.

 

Congratulations, you have successfully created a Metric Definition. 

But, Metrics are configured to work on the task table only. To apply metrics to kb_knowledge table, let us duplicate the metric events business rule that currently runs on the task table for the kb_knowledge table.

Step 7 : Navigate to Metrics > Business Rules & open existing business rule 'metrics events' 

find_real_file.png

Step 8 : Rename it to another unique name

find_real_file.png

Step 9 : Change the table to 'kb_knowledge'

find_real_file.png

Step 10 : Right click on form header and click 'Insert and Stay'

find_real_file.png

Hurray, Now you are ready to calculate the how long an article stays in a particular state from draft to publish

Step 11) Navigate to Metrics > Instances to view the results for future article state changes

find_real_file.png

Thank You.

Vishal Ingle

ServiceNow Certified System Administrator

DxSherpa Technologies Pvt. Ltd.

Maharashtra, India

Comments
JR1
Tera Guru

Thank you for this, very helpful. Were you able to translate it into a report? 

beingfluid
Kilo Sage
Kilo Sage

Hi JR,

Yes, Reporting on a metric is done using the database view that links the metric to the table on which it is defined.

I'll probably write another post on it.

Thank you.

Version history
Last update:
‎07-06-2020 09:42 AM
Updated by: