12/15/22, 7:04 PM NowKB Admin
A. Introduction
Service Reporting enables you to create and distribute reports that show the current state of instance data,
such as the number of open incidents of each priority. Reporting functionality is available by default for all
tables, except for system tables. Displaying reports on service portal will increase the availability of reports to
end users.
B. Configuration
1. Create a widget “My Table Simple”
i. Navigate to Service Portal > Widgets
i. Click New
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 1/8
12/15/22, 7:04 PM NowKB Admin
Name: My Table Simple
ID: my-table-simple
Body HTML Template
CSS
.sortorder:after { content: '\25b2'; // BLACK UP-POINTING TRIANGLE color: #1f8476; }
.sortorder.reverse:after { content: '\25bc'; // BLACK DOWN-POINTING TRIANGLE color: #1f8476;
} .text-color{ color: #1f8476 !important; } table tbody tr td a { font-size: 14px
!important; color: #4b4b4b !important; text-decoration: none !important; }
Server script:
api.controller = function($scope, $rootScope, $filter, $location, $window, $timeout,
spUtil) { (function() { data.incidents = []; var gr = new GlideRecord('incident');
gr.addQuery('state', '3'); gr.query(); while(gr.next()) { var new_data = {}; new_data.number
= gr.getValue('number'); new_data.state = gr.getDisplayValue('state'); new_data.opened_by =
gr.getDisplayValue('opened_by'); data.incidents.push(new_data); } })();
Client Controller
api.controller = function($scope, $rootScope, $filter, $location, $window, $timeout,
spUtil) { /* widget controller */ var c = this; $scope.orderField = 'number'; $scope.sortBy
= function(field) { $scope.orderField = field; $scope.reverse = !$scope.reverse; };
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 2/8
12/15/22, 7:04 PM NowKB Admin
spUtil.recordWatch($scope, "incident", "", function(name, data) { spUtil.update($scope); });
$rootScope.$broadcast('shareTableData', c.data.incidents); };
i. Save
2. Create a page “My Simple Datatable”
i. Navigate to Service Portal > Pages
i. Click New
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 3/8
12/15/22, 7:04 PM NowKB Admin
Name: My Simple Datatable
ID: my_simple_datatable
i. Save
ii. Now Open Page “My Simple Datatable” in Page Designer
Navigate to Service Portal > Pages
Search “My Simple Datatable” and Open
Go to the “Related Links” and click “Open in Page Designer”
Drag and drop a set of columns from the Left pane or use the plus [+] button - then drag and
drop widgets inside
Search for “My Table Simple” in the Search box under Widgets
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 4/8
12/15/22, 7:04 PM NowKB Admin
Add the widget to the page
3. Link “My Simple Datatable” page to report “Incident Resolved” created in previous tutorial
i. Navigate to Reports > View & Run
ii. Open “Incident Resolved” report
iii. Click on the drilldown icon
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 5/8
12/15/22, 7:04 PM NowKB Admin
i. Click on link icon
i. Provide the following details in the modal popup
Label: My Simple Table
URL: /sp?id=my_simple_datatable
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 6/8
12/15/22, 7:04 PM NowKB Admin
C. Testing
1. Open “https://yourinstance.service-now.com/sp?id=my_dashboard” new tab in the browser
2. Click on the bars
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 7/8
12/15/22, 7:04 PM NowKB Admin
https://admin.nowkb.com/article/edit/aa160b69-27b3-4087-bc4e-e550e388ef23 8/8