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.

Create Dynamic Filter to show manager of assignment group all tickets in their groups

Brent Cox
Giga Guru

I would like to set up a dashboard with a report that shows all tickets assigned to groups that the viewer is a manager of. Is it possible to create a dynamic filter for this that can be applied to a report? 

1 REPLY 1

Bert_c1
Kilo Patron

@Brent Cox 

 

Yes, using a Dynamic filter Option defined as:

 

Screenshot 2025-01-30 110506.png

Script Include:

Screenshot 2025-01-30 110615.png

Script from above

 

function ManagerGroups() {
	var mgrGroups = [];
	var grpManager = gs.getUserID();
//	grpManager = '46d44a23a9fe19810012d100cca80666'; // Beth anglin
//	gs.info('ManagerGroups: Manager = ' +grpManager);
	//Get the groups where grpManager is the 'manager'
	var grps = new GlideRecord('sys_user_group');
	grps.addQuery('manager', grpManager);
	grps.query();
	while (grps.next()) {
		//Add the group sys_id values to the returned array
		mgrGroups.push(grps.getValue('sys_id'));
	}

//	gs.info("Returning: " + mgrGroups);
	return mgrGroups;
}

 

Use that for any reference field to 'sys_user_group'. See:

Screenshot 2025-01-30 110913.png