Current Status and Status History Portal Widget not showing discovered, technical or service offering services from outages

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 06:57 AM
I have been digging into Business Services and trying to understand how Service Now is handling these. We are currently setting up Service Mapping and having noticed that a discovered business service will get created on the cmdb_ci_service table as well as service offerings and technical services or service groups. However, these do not show up if we create an outage against one of these service ci's on the Service Portal. They do not show under either the Current Status or the Service History Widgets on the Service Portal.
I am trying to understand the code below that is limiting the glide record query below to only a Business Service class CI from the cmdb_ci_service tables.
// populate the 'data' object
// e.g., data.table = $sp.getValue('table');
data.outages = [];
data.service = (input && input.service) || $sp.getParameter("service");
if (data.service) {
var svc = new GlideRecord("cmdb_ci_service");
if (!svc.get(data.service))
data.service = null;
data.serviceName = svc.getDisplayValue();
var outs = new GlideRecord("cmdb_ci_outage");
outs.orderByDesc("begin");
outs.addQuery("cmdb_ci", data.service);
outs.addNotNullQuery("begin");
outs.addNotNullQuery("end");
outs.addQuery("end", "<=", gs.nowNoTZ());
outs.setLimit(100);
outs.query();
while (outs.next()) {
var out = {};
out.type = outs.type.getDisplayValue();
out.typeValue = outs.getValue("type");
out.beginDisplay = outs.begin.getDisplayValue();
out.beginValue = outs.getValue("begin");
out.duration = outs.duration.getDisplayValue();
data.outages.push(out);
}
}
Is there a reason for this design that I am not finding?
While reading the wiki, understanding the differences between all these 'service' types can be a bit confusing.
Thanks for the help!
-Chris
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 11:01 AM
hi Chris,
Not sure if you ever get this resolved, but it doesn't cost to respond and help, as I'm in similar situation too.
As far as I already learned, the code above you pasted here belongs to the widget Service History which is the one that you would show more details about an specific CI once clicked on the System Status link on your portal.
The code you should be looking for is the one for Service Status, then you would need to update the query based on your requirements.
For us, the requirements was simpler, only to show the most critical Business Services. See below:
- We cloned the Service Status (service_status) widget to allow editing;
- the only change I did so far was to add this: "busines_criticality" == "1 - most critical" on line 16.
// populate the 'data' object
// e.g., data.table = $sp.getValue('table');
data.systemStatusBreadcrumb = gs.getMessage("System Status");
data.service = $sp.getParameter("service");
var service = new GlideRecord("cmdb_ci_service");
if (service.get(data.service))
data.serviceDisplay = service.getDisplayValue();
else
(data.service = null);
data.days = [];
for (var i = 89; i >= 0; i--) {
var day = {};
day.date = new GlideDateTime(gs.daysAgo(i)).getLocalDate().getDisplayValue();
var out = new GlideAggregate("cmdb_ci_outage");
out.addQuery("cmdb_ci", service.getUniqueValue());
out.addQuery("cmdb_ci", service.orderBy("busines_criticality" == "1 - most critical"));
out.addQuery("end", ">=", gs.daysAgoStart(i));
out.addQuery("begin", "<=", gs.daysAgoEnd(i));
out.addAggregate('COUNT', 'type');
out.query();
day.count = 0;
while (out.next()) {
var type = out.type;
var typeCount = out.getAggregate('COUNT', 'type');
day[type] = typeCount;
day.count += typeCount;
}
day.msg = gs.getMessage("No issues");
day.color = "#5cb85c";
if (day.count > 1) {
day.msg = gs.getMessage("Multiple issues");
day.color = "#6E4CDD";
} else if (day.outage > 0) {
day.msg = gs.getMessage("Outage");
day.color = "#BB0000";
} else if (day.degradation > 0) {
day.msg = gs.getMessage("Service degradation");
day.color = "#f0ad4e";
} else if (day.planned > 0) {
day.msg = gs.getMessage("Planned maintenance");
day.color = "#5bc0de";
}
data.days.push(day);
}
What I found to be a little tricky was the widgets name:
The number 1 above is the OOB widget that is presented when we click on System Status on page header.
I cloned to edit in the number 2 (code above).
The third one is the page that shows more information on the Ci when we click on the CI name.
That third page contains the widget Service History (the one with your code), which I also cloned to edit on the line 12 to pick up the CI based on the criticality.
I'm still learning all this stuff at fast pace, so disregard if I told anything wrong. 🙂