Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add Group By layer to Status History widget

EricG
Kilo Sage

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). 

EricG_0-1704980630507.png

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

EricG_2-1704981335014.png

Any suggestions or help will be greatly appreciated.

 

 

 

0 REPLIES 0