- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:37 PM
I am trying to check if the current user is a manager of any group. I have checked if the current user is a group member of any group and it works great. I am just not sure of the table and what not to check if the current user is a manager of any group. Can anyone advice?
Group Member Logic:
var uID = g_user.userID;
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('user', uID);
grmember.addQuery('group.active', true);
grmember.query();
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:46 PM
Hi Josh,
Sure. The correction needed in 2nd and 3rd line of code. Please check the script shared and it should work.
Please let me know if you are blocked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:39 PM
Hi Josh,
You can directly use.
gs.getUser().isMemberOf( Â'Capacity Mgmt'); //Pass the group name here.
This will return true if the memeber is part of the group.
However your script will be
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('user',uID);
grmember.query();
while(grmember.next())
{
//your logic
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:43 PM
Pradeep,
The group member functionality works fine. I am looking to see if current user is manager of any group, not specific group.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:46 PM
Hi Josh,
Sure. The correction needed in 2nd and 3rd line of code. Please check the script shared and it should work.
Please let me know if you are blocked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-22-2023 08:09 AM
try s.th. like:
var user = gs.getUserID(); //current user sys_id
var target = new GlideRecord('sys_user_group');
target.addQuery('manager', user);
target.query();
if (target.next()) {
answer = true;
} else {
answer = false;
}