- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 03:15 AM
Hi Guys
I am using the report widget in service portal with the report as single score, it looks good. However, when the user clicks on it it takes them to list of records.
How can i stop that happening and just have it for display value
Clicking takes me to
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 03:53 AM
Ah OK, I think that was recently released as ServiceNow hadn't previously included a report widget. If the OOB widget doesn't have the functionality you want then you could install the one I just shared with you, submit an enhancement request to ServiceNow or write your own widget / copy and edit the OOB widget.
If you are just after "Single Score" Reports, it's a pretty simple widget to write yourself as all it is really is a GlideRecord Query Row Count. Infact, I did just that myself a few months ago. Picture below.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 04:47 AM
HTML Template
<div class="panel" style="text-align:center;">
<div ng-if="options.table">
<h4>
{{ options.title }}
</h4>
<h1>
{{ data.record_count }}
</h1>
</div>
<div ng-if="!options.table">
<h4>
Select a table from options
</h4>
</div>
</div>
Server Script
(function() {
// find the table
if(options.table){
var table = new GlideRecord("sys_db_object");
table.get(options.table);
var gr = new GlideRecord(table.name.toString());
gr.addEncodedQuery(options.query)
gr.query();
data.record_count = gr.getRowCount();
}
})();
Widget Options Schema
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2017 04:51 AM
Thank you very much Callum, very helpful

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2018 10:41 PM
How can this be updated to update in real time similar to when you set a report on a dashboard to update in real time?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2018 03:04 AM
I have a post on my website with a slightly more rounded version of the code from above, Creating a simple 'Record Count' Service Portal Widget | Callum's ServiceNow Blog
If you follow that tutorial you will be at a stage where you can add the code below in the client script of the widget, that will give you a live updating record count.
function(spUtil, $scope, $timeout) {
/* widget controller */
var c = this;
$scope.table = {};
$scope.table.updated = false;
c.last_record_count = c.data.record_count;
spUtil.recordWatch($scope, c.data.table_name, c.options.encoded_query_string, function(name, data) {
c.last_record_count = c.data.record_count;
c.server.update().then(function(){
if(c.last_record_count != c.data.record_count){
$scope.table.updated = true;
$timeout(function(){
$scope.table.updated = false;
}, 1000);
}
});
});
}