logo

NJP

Metric on Knowledge Workflow State - How to read the Docs - Metrics 1

Import · Jul 06, 2020 · article

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,

image

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

Step 2 : Give it a unique name

image

Step 3 : Select the Knowledge (kb_knowledge) table

image

Step 4 : Select the field as 'Workflow'

image

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

image

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();
}

image

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'

image

Step 8 : Rename it to another unique name

image

Step 9 : Change the table to 'kb_knowledge'

image

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

image

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

image

Thank You.

Vishal Ingle

ServiceNow Certified System Administrator

DxSherpa Technologies Pvt. Ltd.

Maharashtra, India

View original source

https://www.servicenow.com/community/platform-analytics-articles/metric-on-knowledge-workflow-state-how-to-read-the-docs-metrics/ta-p/2301855