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

@Matthew Fody 

I'm sorry, what worked for you?  I'm trying to follow along, and I'm struggling.

So going to spell out what I think you mean number by number.

1. The scoped table, needs to be audited, so go to the dictionary, and set audit to true.

2. Create a metric definition within the same scope as the scoped table.  Example created table "Content" in Scope "Blog".  So now we need to create a Metric Definition in "Blog" scope.

3. In scope "Global" go to the business rule named "metric update".  I don't see a rule with that name, I see one with "metric events", is this the rule you meant?

4. That table you looked at in the scope, needs to have the "Accessible from" set to "All applications scopes" not "This application scope only".

 

I haven't tried this today, I can later.  Is this correct above?

Hey Jace, hopefully these are more clear steps to implement what I mentioned before.

1. On the table record (in sys_dictionary), set audit=true (checkbox with check)

2. Metric Definition should be in "Blog" scope. So change scope to Blog, then create new Metric Defn pointing to your scoped table.

3. Go to "Metrics > Business Rules" and make a new BR in the global scope. Copy everything from the existing "metric events" BR that is pointing at Task table and point it to your scope table. (apologies on the name mix up)

4. In the sys_db_object record for the table, go to the "Application Access" tab in the related lists. Accessible from = All application scopes, Can read = true (checkbox), Can create = true, Can update = true, Can delete = true, Allow access to this table via web services  = true

* did not play around with the options much in step 4, that is just what I had on my scoped table