Report condition to check if caller is part of the assignment group

Sam198
Mega Guru

Hi all,

I need to create a report to show the Incidents where the caller is also member of the Assignment group when resolved.

Cannot seem to find any condition that would match this criteria, is there any other way i can achieve this?

Thanks.

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

you can create here on client callable script include and write the below code there. and then in list view or report you can add the filter condition like below. 

 

Script Include: Make sure it should be client callable. 

 

find_real_file.png

 

 

var callergrpmem = Class.create();
callergrpmem.prototype = Object.extendsObject(AbstractAjaxProcessor, {


	getMember: function(){
		var arr =[];

		var gr = new GlideRecord('incident');
		gr.addQuery('active',true);
		gr.addEncodedQuery('assignment_groupISNOTEMPTY');
		gr.query();
		while(gr.next()){

			var grmember = new GlideRecord('sys_user_grmember');
			grmember.addQuery('group','IN',gr.assignment_group);
			grmember.addQuery('user','IN',gr.caller_id);
			grmember.query();
			while(grmember.next()){

				arr.push(gr.number.toString());
			}
		}	
		return arr;

	},

	type: 'callergrpmem'
});

 

Filter Condition 

 

Number | Is one Of | javascript: new global.callergrpmem().getMember()

 

find_real_file.png

 

Hope it will help you. 

 

 

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Sam,

Are you saying if you login and check the report then it should show incidents where you are the member of the incident assignment group?

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Harsh Vardhan
Giga Patron

you can create here on client callable script include and write the below code there. and then in list view or report you can add the filter condition like below. 

 

Script Include: Make sure it should be client callable. 

 

find_real_file.png

 

 

var callergrpmem = Class.create();
callergrpmem.prototype = Object.extendsObject(AbstractAjaxProcessor, {


	getMember: function(){
		var arr =[];

		var gr = new GlideRecord('incident');
		gr.addQuery('active',true);
		gr.addEncodedQuery('assignment_groupISNOTEMPTY');
		gr.query();
		while(gr.next()){

			var grmember = new GlideRecord('sys_user_grmember');
			grmember.addQuery('group','IN',gr.assignment_group);
			grmember.addQuery('user','IN',gr.caller_id);
			grmember.query();
			while(grmember.next()){

				arr.push(gr.number.toString());
			}
		}	
		return arr;

	},

	type: 'callergrpmem'
});

 

Filter Condition 

 

Number | Is one Of | javascript: new global.callergrpmem().getMember()

 

find_real_file.png

 

Hope it will help you.