Service Portal Status History

Aaron Vinyard
Tera Contributor

I am trying to figure out why the "Last 90 days" and the "Status History" sections of the system status is showing as green when there is a current (not ended) outage on a business service.  For example, I have a degradation on SAP Human Resources which started long ago...

find_real_file.png

The Status History shows as follows:

find_real_file.png

And the Service Status page shows:

find_real_file.png

The moment I enter an end date on the outage, it all updates with a history of a degradation.

find_real_file.png

find_real_file.png

It would be nice for a current outage to show as such on these pages even before the outage is ended.  Is this intended, do I have a bug?

 

 

 

2 REPLIES 2

Allen Andreas
Administrator
Administrator

Hello,

OOB the widget doesn't show the "current" status in the 90 day history bar. It only shows once disruption has ended.

You can however, clone and modify the code to make it show there as well by following instructions in this link: https://community.servicenow.com/community?id=community_question&sys_id=c868c3eddb1cdbc01dcaf3231f96...

I did and it worked for me.

Thanks!

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

OK, so that link appears to be dead but I'll just drop this script here, because I got it working with this.

This is a replacement for the Server Script in the Service Status widget.

// populate the 'data' object
// e.g., data.table = $sp.getValue('table');
data.systemStatusBreadcrumb = gs.getMessage("System Status");
data.navHelpMsg = gs.getMessage("Use left/right arrow keys to navigate the status history");
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("begin", "<=", gs.daysAgoEnd(i));
  out.addOrCondition("end", ">=", gs.daysAgoEnd(i));
  out.addOrCondition("end", "IS", null);
  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";
  day.id = "no-issues";
  if (day.count > 1) {
    day.msg = gs.getMessage("Multiple issues");
    day.color = "#6E4CDD";
    day.id = "multiple";
  } else if (day.outage > 0) {
    day.msg = gs.getMessage("Outage");
    day.color = "#BB0000";
    day.id = "outage";
  } else if (day.degradation > 0) {
    day.msg = gs.getMessage("Service degradation");
    day.color = "#f0ad4e";
    day.id = "degredation";
  } else if (day.planned > 0) {
    day.msg = gs.getMessage("Planned maintenance");
    day.color = "#5bc0de";
    day.id = "planned-maintenance";
  }
  data.days.push(day);
}