- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 09:49 AM
I have a request to start showing the Status History section of the System Status page on our Service Portal. This section is the Business Services Status widget. I am trying to customize to only show our Service Offerings. Can someone please help guide me on what I am missing to only show these. Below are the HTML and Server Script sections of the widget.
HTML:
<div class="panel panel-default">
<div class="panel-heading"> </div>
<div class="panel-body">
<table class="tb">
<thead>
<th scope="col">
<h2 class="panel-title title">
${Status History}
</h2></th>
<th scope="col" ng-repeat="date in ::data.dates" class="date-column">{{::date.month}} {{::date.day}}</th>
</thead>
<tbody>
<tr ng-repeat-start="category in ::c.data.categories" aria-hidden="true">
<th scope="col" colspan="6" title="{{::category.label}}"><h3 class="title category" ng-bind-html="::category.label"></h3></th>
</tr>
<tr ng-repeat-end ng-repeat="service in ::category.services">
<td scope="row">
<small ng-if="::service.subscribed" class="subscribed" title="${Subscribed to updates}" aria-label="${Subscribed to updates}"><i class="fa fa-envelope"></i></small>
<a ng-href="?id=service_status&service={{::service.sys_id}}" ng-bind-html="::service.name"></a>
</td>
<td ng-repeat="n in [0,1,2,3,4] track by $index" class="outage-row">
<span class="fa" ng-class="::service.outages[4-$index].icon"
sp-tooltip
aria-label="{{::data.dates[$index].month + ' ' + data.dates[$index].day + ' - ' + service.outages[4-$index].msg}}"
role="application"
tooltip-smart="true"
tooltip-speed="slow"
tooltip-size="large"
tooltip-template="{{::service.outages[4-$index].msg + ' - ' + data.dates[$index].month + ' ' + data.dates[$index].day}}">
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
Server Script:
(function() {
data.monthTranslations = {
'Jan': gs.getMessage("Jan"),
'Feb': gs.getMessage("Feb"),
'Mar': gs.getMessage("Mar"),
'Apr': gs.getMessage("Apr"),
'May': gs.getMessage("May"),
'Jun': gs.getMessage("Jun"),
'Jul': gs.getMessage("Jul"),
'Aug': gs.getMessage("Aug"),
'Sep': gs.getMessage("Sep"),
'Oct': gs.getMessage("Oct"),
'Nov': gs.getMessage("Nov"),
'Dec': gs.getMessage("Dec")
};
data.categories = [];
var svs = new GlideRecord("cmdb_ci_service");
//svs.addQuery("sys_class_name", "cmdb_ci_service");
svs.setLimit(options.number_of_services || 2000);
svs.orderBy("category");
svs.orderBy("name");
svs.query();
var currentCategory = "-";
var catIndex = -1;
while (svs.next()) {
var cat = svs.getValue("category");
if (cat != currentCategory) {
catIndex++;
currentCategory = cat;
data.categories[catIndex] = {};
data.categories[catIndex].name = cat;
data.categories[catIndex].label = svs.getDisplayValue("category");
if (data.categories[catIndex].label == "")
data.categories[catIndex].label = gs.getMessage("Service");
data.categories[catIndex].services = [];
}
var svc = {};
svc.sys_id = svs.getUniqueValue();
svc.name = svs.getDisplayValue();
svc.safeName = GlideStringUtil.escapeHTML(svc.name);
svc.subscribed = isSubscribed(svc.sys_id);
var outs = [];
for (var i = 0; i <= 4; i++) {
var out = new GlideAggregate("cmdb_ci_outage");
out.addQuery("cmdb_ci", svs.getUniqueValue());
out.addQuery("end", ">=", gs.daysAgoStart(i));
out.addQuery("begin", "<=", gs.daysAgoEnd(i));
out.addAggregate('COUNT', 'type');
out.query();
var svcOutageDay = {};
svcOutageDay.count = 0;
while (out.next()) {
var type = out.type;
var typeCount = out.getAggregate('COUNT', 'type');
svcOutageDay[type] = typeCount;
svcOutageDay.count += typeCount;
}
svcOutageDay.icon = "fa-check-circle";
svcOutageDay.msg = gs.getMessage("{0} - no outage", svc.safeName);
if (svcOutageDay.count > 1) {
svcOutageDay.icon = "fa-plus-circle";
svcOutageDay.msg = gs.getMessage("{0} - multiple issues", svc.safeName);
} else if (svcOutageDay.outage > 0) {
svcOutageDay.icon = "fa-exclamation-circle";
svcOutageDay.msg = gs.getMessage("{0} - outage", svc.safeName);
} else if (svcOutageDay.degradation > 0) {
svcOutageDay.icon = "fa-minus-circle";
svcOutageDay.msg = gs.getMessage("{0} - degradation of service", svc.safeName);
} else if (svcOutageDay.planned > 0) {
svcOutageDay.icon = "fa-info-circle";
svcOutageDay.msg = gs.getMessage("{0} - planned maintenance", svc.safeName);
}
outs.push(svcOutageDay);
}
svc.outages = outs;
data.categories[catIndex].services.push(svc);
}
data.dates = [];
for (var i = 5; i > 0; i--) {
var d = new GlideDate();
d.subtract(1000 * 3600 * 24 * (i - 1));
data.dates.push(d.getDisplayValueInternal());
}
function isSubscribed(id) {
var subs = new GlideRecord("m2m_sp_status_subscription");
subs.addQuery("sys_user", gs.getUserID());
subs.addQuery("cmdb_ci_service", id);
subs.query();
return subs.hasNext();
}
})();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 04:34 PM
Service Offering is extended from Business Service, so you can do this simply by changing the table you are looking at.
Change
var svs = new GlideRecord("cmdb_ci_service");
To
var svs = new GlideRecord("service_offering");
Please mark correct ✅ if this solves your issue and helpful 👍 if it has assisted you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 04:34 PM
Service Offering is extended from Business Service, so you can do this simply by changing the table you are looking at.
Change
var svs = new GlideRecord("cmdb_ci_service");
To
var svs = new GlideRecord("service_offering");
Please mark correct ✅ if this solves your issue and helpful 👍 if it has assisted you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 05:14 PM
Hi,
As Aidan mentioned you can simply change the table that the glide is querying to alter what appears there. A few things though:
1) Only business services are what show on the service portal "current status" widget. With only showing the service offerings on the overall status page, is the business looking for consistency in terms of what is actually shown as an outage on the main page through the current status widget? Meaning...are they also expecting to only use service offerings for outages to the customer view?
2) If so, you'd need to do a similar type edit to the current status widget.
3) If not, then do you all report outages against the service offering or was it only to certain CIs (again like only business service since that was what was only showing on the portal main page current status widget) or was it to any and all?
I guess I'm asking for the overall goal here from the business. Maybe it's as simple as: hey...only the status page...we just want to show the history of service offerings. That's it. Then ok.
If not, and it's more like: well, we want to start only focusing on "service offering" to our end-users. Then you're going to need more edits than just what was mentioned here.
Anyways, just wanted to check-in on that and see if there was more here than just making a quick gliderecord table change.
Also, I would considering adding in a query for filtering out non-operational service offerings, otherwise, you're having a bit more exposed than the business may want (whether that's now or in the future):
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2020 10:32 AM
Hi,
I just wanted to check-in and see how you're doing.
If my reply above helped answer your question and guide you correctly, please mark it as "Helpful" and "Correct.
If you still need assistance, let us know.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2020 08:17 AM
Hi,
I just wanted to check-in and see if my reply above answered your question?
If so, please mark it as Correct/Helpful.
If not, let us know so we can continue to assist.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!