Metrics in Scoped Apps

EdwinCoronado
ServiceNow Employee
ServiceNow Employee

Hello,

I have a table (doesn't extend Task) in a scoped app that has a "State" field which I want to keep track of time of how long a record spends in each of these states. In the ServiceNow documentation for Metric definitions I found the following:

Note: In the base system, metrics are configured to work on the task table only. To apply metrics to cmdb_ci tables, duplicate the metric events business rule that currently runs on the task table for the cmdb_ci table. Without the events created, no metric processing can occur.

However, when I look at the "metric events" business rule in the Task table, I see that it's inserting an event (metric.update) which is in the global scope. When I then look at the Script Action that runs when that event is inserted, I see that it instantiates an object (script include) called "MetricInstance". This script include is also only available in the Global scope, and the table that it writes to (metric_instance) is ALSO only available in the global scope. I know that a "quick" solution would be to make the table and script include public for other scopes to use, but this is not an option in my case. 

Any help would be appreciated! 

21 REPLIES 21

I'm going to have to give it a try.  I have a bit on my plate lately so it might be a bit but I love that I'm optimistic with your reply!

Sure thing. Hope it helps you out. 🙂

 

To be honest, I was a bit surprised that this is not OOTB supported for scoped applications. It's not uncommon to report on metrics (e.g. status changes).

@Jace Benson One additional finding that I had yesterday: I needed to put the "Script Action" into the Global Scope (as I've created another metrics for a non-task extended table) as I have had many "Does not work in scoped App" issues. 

Putting the Script Action into the Global scope solved that for me.

Community Alums
Not applicable

Thanks, Julian for sharing this!

I have followed these steps and used this business rule 

Bkimani_0-1723044430036.png

and this metric definition :

Bkimani_1-1723044478114.png

I still can't get metrics back