The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Metrics in Scoped Apps

edwin24
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! 

16 REPLIES 16

Adam Stout
ServiceNow Employee
ServiceNow Employee

As you stated, there is an issue with the normal way we add metrics to non-task tables by copying the BR if the new table is scoped.  I have gotten it to work for duration metrics (I haven't tested scripted metrics).  It requires rewriting the BR, the script action, and the Metric Instance script include.  When I rewrote it, I created a new version of each.

The simple solution is to extend task, but if not, it is possible, but a little time-consuming at this point.

Adam could you share the specific things you made to get this working?

I can create the Business rule, Script Action, and MetricInstance too, but why do that when I can just ask if you can share the specifics?

 

Hi, did you ever get this to work? 

I'm in same situation now, but I'm stuck with the copy of the business rule, the GlideScriptRecordUtil class doesnt run in scoped applications.

I was able to get this to work with help, but It's been a few weeks, where is it failing for you?