Metrics in Scoped Apps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2020 09:41 AM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2023 12:19 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2023 11:44 PM - edited 02-05-2023 11:45 PM
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 11:23 PM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 10:06 PM
Thanks, Julian for sharing this!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 08:28 AM
I have followed these steps and used this business rule
and this metric definition :
I still can't get metrics back