This is a widget that you can use to show multiple data tables lists on your service portal, it comes OOTB with 3 tabs, but could easily be extendable and configurable to include more tabs.
Installation Steps
Client Script
Configure the tab names
Server Script
Configure the tables, fields ,filters and pages that open on list click.
Portal
Add it to any page.
Screenshot
HTML Template
CSS
Client Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function ($scope, spUtil, $location, spAriaFocusManager, $timeout) {
var c = this;
$scope.$on('data_table.click', function(e, parms){
var p = $scope.data.page_id || 'support_ticket' ;
var s = {id: p, table: parms.table, sys_id: parms.sys_id, view: 'sp'};
var newURL = $location.search(s);
spAriaFocusManager.navigateToLink(newURL.url());
$scope.$destroy();
});
c.$onInit = function() {
c.selectedTab = 'one';
};
c.tabs = {
firstTab: {
name: '${TAB 1 NAME}'
},
secondTab: {
name: '${TAB 2 NAME}'
},
thirdTab: {
name: '${TAB 3 NAME}'
}
};
}
Server Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
(function() {
/* "use strict"; - linter issues */
// populate the 'data' object
var sp_page = $sp.getValue('sp_page');
var pageGR = new GlideRecord('sp_page');
var limit = options.max_entries || 5;
data.hasItilRole = gs.getUser().hasRole('itil');
pageGR.get(sp_page);
data.page_id = pageGR.getValue("id");
$sp.getValues(data);
if (data.field_list) {
data.fields_array = data.field_list.split(',');
} else {
data.field_list = $sp.getListColumns(data.table);
}
if (input) {
data.p = input.p;
data.o = input.o;
data.d = input.d;
data.q = input.q;
}
data.p = data.p || 1;
data.o = data.o || $sp.getValue('order_by');
data.d = data.d || $sp.getValue('order_direction');
data.page_index = (data.p - 1);
data.window_size = $sp.getValue('maximum_entries') || 10;
data.window_start = (data.page_index * data.window_size);
data.window_end = (((data.page_index + 1) * data.window_size));
data.filter = $sp.getParameter('filter') || $sp.getValue("filter");
var gr = new GlideRecordSecure(data.table);
if (!gr.isValid()) {
data.invalid_table = true;
data.table_label = data.table;
return;
}
data.table_label = gr.getLabel();
var widget1Params = {
table: 'TABLE',
fields: "FIELD1,FIELD2,FIELD3",
o: data.o,
d: data.d,
filter: "FILTER_ENCODED_QUERY",
hide_header: true,
enable_filter: true,
color: 'primary',
window_size: data.window_size,
view: 'sp',
headerTitle: options.title,
page: 'PAGE_ON_CLICK',
show_breadcrumbs: true
};
var widget2Params = {
table: 'TABLE',
fields: "FIELD1,FIELD2,FIELD3",
o: data.o,
d: data.d,
filter: "FILTER_ENCODED_QUERY",
hide_header: true,
enable_filter: true,
color: 'primary',
window_size: data.window_size,
view: 'sp',
headerTitle: options.title,
page: 'PAGE_ON_CLICK',
show_breadcrumbs: true
};
var widget3Params = {
table: 'TABLE',
fields: "FIELD1,FIELD2,FIELD3",
o: data.o,
d: data.d,
filter: "FILTER_ENCODED_QUERY",
hide_header: true,
enable_filter: true,
color: 'primary',
window_size: data.window_size,
view: 'sp',
headerTitle: options.title,
page: 'PAGE_ON_CLICK',
show_breadcrumbs: true
};
data.listWidget1 = $sp.getWidget('widget-data-table', widget1Params);
data.listWidget2 = $sp.getWidget('widget-data-table', widget2Params);
data.listWidget3 = $sp.getWidget('widget-data-table', widget3Params);
})();