Monday, July 6, 2020

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

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,

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'

Step 2 : Give it a unique name

Step 3 : Select the Knowledge (kb_knowledge) table

Step 4 : Select the field as 'Workflow'

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

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

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' 

Step 8 : Rename it to another unique name

Step 9 : Change the table to 'kb_knowledge'

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

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

Thank You.

Vishal Ingle

ServiceNow Certified System Administrator

DxSherpa Technologies Pvt. Ltd.

Maharashtra, India

No comments:

Post a Comment