- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
There is an OOB UI Action called "Metrics Timeline" that appears on all Task tables:
It pops up a window and displays the metrics defined on that table in a nice timeline view:
Nice feature, but the problem is the UI Action appears in all Task tables regardless of whether there are metrics defined AND configured to be displayed in a timeline view or not - http://wiki.servicenow.com/index.php?title=Timeline_Pages#Displaying_Metrics_as_Timelines. By default, only the Incident ones are configured this way.
I had a client who wanted to only display the UI Action where it was appropriate. The solution was to modify the condition of the UI Action so it only displays on tables where there are metrics configured to be displayed in the timeline view. To do this, modify the UI Actions condition to be:
Berlin instances:
!current.isNewRecord() && u_displayMetricsInTimeline(current.sys_class_name)
Calgary instances:
!current.isNewRecord() && !GlideMobileExtensions.runningTablet() && u_displayMetricsInTimeline(current.sys_class_name)
...and add the following Script Include:
Name: u_displayMetricsInTimeline
Active: checked
Script:
function u_displayMetricsInTimeline(tableName) {
var ga = new GlideAggregate("metric_definition");
ga.addEncodedQuery("active=true^timeline=true^table=" + tableName);
ga.addAggregate("COUNT");
ga.query();
if (ga.next() && ga.getAggregate("COUNT")>0) {
return true;
} else return false;
}
Now it will only appear on the appropriate tables and will appear automagically as you configure more metrics to be viewable in the timeline view. I've attached the Script Include XML file for import into your instance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.