Upcoming in SOW - ignore resolved

Henrik Jutterst
Kilo Sage

I need to exclude resolved incidents in "Upcoming" in SOW so that we don't see any resolved incidents. OOB it's showing all active incidents.

 

HenrikJutterst_0-1768230879073.png

 

HenrikJutterst_0-1768231153567.png

 

 

 

I go to:
All -> Service Operations Workspace Admin Center -> Configurations

and click "Configure" on "Upcoming tasks"

HenrikJutterst_0-1768229125826.png


I added this code where I added IGNORE_STATUS:

var SOWUpcoming = Class.create();
SOWUpcoming.prototype = Object.extendsObject(sn_sow_inc.SOWUpcomingSNC, {

	IGNORE_STATUS: "state!=6", //is not resolved
    
	_getIncidentWithSLAAtRisk: function() {
		var encodedQueryToday = [
			this.ACTIVE_RECORD, this.IGNORE_STATUS, this.ASSIGNED_TO_ME,
			"JOINincident.sys_id=task_sla.task!" + this._getTodayDateQuery("planned_end_time"),
			"JOINincident.sys_id=task_sla.task!has_breached=false"
		].join("^");
		var encodedQueryTomorrow = [
			this.ACTIVE_RECORD, this.IGNORE_STATUS, this.ASSIGNED_TO_ME,
			"JOINincident.sys_id=task_sla.task!" + this._getTomorrowDateQuery("planned_end_time")
		].join("^");
		var todayValue = this._getTableCount(this.TABLE.INCIDENT, encodedQueryToday);
		var tomorrowValue = this._getTableCount(this.TABLE.INCIDENT, encodedQueryTomorrow);
		this._addToTotal(todayValue, tomorrowValue);
		var result = {
			"label": {
				"value": gs.getMessage("incident with SLA at risk"),
				"plural": gs.getMessage("incidents with SLA at risk"),
			},
			"title": {
				"value": gs.getMessage("Incident"),
				"plural": gs.getMessage("Incidents"),
			},
			"today": { "value": todayValue },
			"tomorrow": { "value": tomorrowValue }
		};
		gs.info("heju encodedQueryToday:");
		if (todayValue === 1)
			result.today.sysId = this._getRecordSysId(this.TABLE.INCIDENT, encodedQueryToday);
		else
			result.today.encodedQuery = encodedQueryToday;
		if (tomorrowValue === 1)
			result.tomorrow.sysId = this._getRecordSysId(this.TABLE.INCIDENT, encodedQueryTomorrow);
		else
			result.tomorrow.encodedQuery = encodedQueryTomorrow;	
		return result;
	},

    type: 'SOWUpcoming'
});

 

Saved it and hoped for the best, but it's not excluding resolved incidents.

Anyone with an idea? I've tried google and Copilot without success.

 

I have a gs.info() in the code, but it's not triggering. What is wrong?

 

HenrikJutterst_1-1768229495418.png

 

1 ACCEPTED SOLUTION

Henrik Jutterst
Kilo Sage
1 REPLY 1

Henrik Jutterst
Kilo Sage

Solved using this Community Post: Configure upcoming tasks on SOW