Add Group By layer to Status History widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 05:56 AM
I'm wanting to be able to add a "Group By" on the System Status Portal page widget, so that my List of Services are grouped by company code (I have four different companies).
This way customers can easy navigate to their company specific items.
I've cloned the OOB widget and updated the Server Script accordingly
data.categories = [];
var svs = new GlideRecord("cmdb_ci_business_app");
svs.addQuery("sys_class_name", "IN", "cmdb_ci_business_app");
svs.setLimit(options.number_of_services || 250);
//svs.orderBy("category");
svs.groupBy("My Company Code");
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].id = "service_"+catIndex;
data.categories[catIndex].label = svs.getDisplayValue("category");
if (data.categories[catIndex].label == "")
data.categories[catIndex].label = gs.getMessage("Service");
data.categories[catIndex].services = [];
}
adding the GroupBy didn't change how the widget looks. What i'm attempting to achieve is something like:
STATUS HISTORY
Business Application
Company1
App 1
App2
Company2
App3
App4
etc....
or possibly a way to have a pull down filter that would only show those apps for one company at a time.
**similar to how Reports show is
Any suggestions or help will be greatly appreciated.