- 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:40 PM
The below link should help you further.
http://wiki.servicenow.com/index.php?title=Getting_a_User_Object#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:42 PM
You have manager field in Group table. so something like below should work
var grmember = new GlideRecord('sys_user_group');
grmember.addQuery('manager',uID);
grmember.addQuery('active', true);
grmember.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:44 PM
Srinivas,
Will try this now, could not find the manager field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2015 12:57 PM
Hi Josh,
Here is the updated script : This will check if the current user is manager of any group. You can add one more query here if you want only active records.
var uID = g_user.userID;
var grmember = new GlideRecord('sys_user_group');
grmember.addQuery('manager', uID);
grmember.query();
while(grmember.next())
{
//your logic
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2017 02:19 AM
how can we add these conditions in condition box?