Print assignment group group and their members in which current logged in user is present

Shubham_verma
Tera Contributor

hi ,

I want to display assignment group names and their members in which current logged in user is part of?

6 REPLIES 6

Mark Manders
Mega Patron

Where do you want to display that and more important: why? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Community Alums
Not applicable

in background or fix script

Sandeep Rajput
Tera Patron
Tera Patron

@Shubham_verma Here are two ways you can find it.

 

1: Via List: 

Add the following filter in the list.

Screenshot 2024-03-15 at 8.10.06 PM.png

 

2. Via Script:

 

 

var sysGroup = new GlideRecord('sys_user_grmember');
sysGroup.addEncodedQuery('group.sys_idINjavascript: gs.getUser().getMyGroups();');
sysGroup.query();
while(sysGroup.next()){    
gs.info('Group Name '+sysGroup.group.name);
gs.info('Member Name '+sysGroup.user.name);
}

Hope this helps.

Community Alums
Not applicable

it's only showing total run time when I executed this in fix script.It's not showing group names n members