Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Same user added multiple times in a group. How to take this report ?

KingshukM
Giga Contributor

Same User added more than once in a group.I want to make a report I tried with sys_user_grmember table, but it didn't help.

#reports

 

1 REPLY 1

Tanushree Maiti
Tera Sage

Hi @KingshukM 

 

Create a function in a scriptInclude to find duplicate user

function getDupGrpMember (){
	var dupRecord = [];
		var gaDupCheck =new GlideAggregate('sys_user_grmember');
		gaDupCheck.addAggregate('COUNT','user');
		gaDupCheck.addNullQuery('user');
		gaDupCheck.groupBy('user');
		gaDupCheck.addHaving('COUNT','>','1');
		gaDupCheck.query();
		while (gaDupCheck.next()) {
			dupRecord.push (gaDupCheck.getValue('user'));
		}
		return dupRecord;
}

 

Then Go to Report ->Sys_user table 

 

call that function from report condition:

TanushreeMaiti_0-1773850262201.png

 

Then add a related list condition "greater than 1" on the table "Groups" with the filter "group.roles is pps_resource"

 

 

TanushreeMaiti_1-1773850308041.png

 

 

Refer: https://www.servicenow.com/community/spm-forum/report-to-show-duplicate-group-members-using-a-script...

 

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: