- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 01:24 AM
Hi Everybody,
Context: Group management is a mess and we are doing some data clean up.
I work with reporting and would like to make a report to find if the group manager is also in the same group member list.
I have tried in tables below but cant find any result
[sys_user_group]
[sys_user_grmember]
Many thanks for any idea.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 09:31 PM
Hi @tengkuzul
It will be all of the remaining groups when you compare to this list.
URL: https://<instance_name>/sys_user_grmember_list.do?sysparm_query=userSAMEASgroup.manager
Just filter out the groups you find with above query, you'll have the list of the remaining groups.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 01:57 AM
Did you try to use database view?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 02:04 AM
this background script will give same result and list down the groups
Run this as admin in background script
try{
var groupArray = [];
var groupRec = new GlideRecord('sys_user_group');
groupRec.addEncodedQuery("managerISNOTEMPTY");
groupRec.query();
while(groupRec.next()){
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", groupRec.getUniqueValue());
gr.addQuery("user", groupRec.manager);
gr.query();
if(gr.hasNext())
groupArray.push(groupRec.getValue('name'));
}
gs.info("Groups where group manager is also a member: " + groupArray);
}
catch(ex){
gs.info(ex);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 03:22 AM - edited 10-12-2023 03:24 AM
Hi @tengkuzul
Let's try the below query.
URL: https://<instance_name>/sys_user_grmember_list.do?sysparm_query=userSAMEASgroup.manager
Let me know if it works for you!
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 05:41 AM
Hi,
Thanks for the answer.
This sorta helps but now it leaves me to figure out which groups manager is not in the group member list.