- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 05:09 AM
Hi ,
I want the Assignment group to show logged-in users groups currently I have a script that shows selected users group
what modifications to be done to the script and what should be the reference qualifier.
Kindly help me
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 05:14 AM
Hi,
please update this query
grAssigneeGroups.addQuery('user', gs.getUserID());
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 05:14 AM
Hi,
please update this query
grAssigneeGroups.addQuery('user', gs.getUserID());
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2020 05:21 AM
Sorry - I think I mis-read the idea. Ankur's approach is the right way to go.
Do all of your users have only one assignment group (a single group they are a member of) or do they have multiple groups that they belong to? You would need to determine how you would identify the assignment group in a situation where multiple might be available, otherwise you will just end up with an array of all of the groups the user is a member of.
So you would need to adjust your grAssigneeGroups.addQuery() as advised above ('user', gs.getUserID()); but also add some additional criteria using grAssigneeGroups.addQuery() to limit your results to the one group you want.
In the past, I've seen companies add a group reference field to the sys_user record and call it "Primary Assignee Group" and set the group on the user record. If you did this, you could get the group with a simple call like this:
user = new GlideRecord('sys_user');
user.get(gs.getUserID());
group = user.u_primary_assignee_group
I hope this helps!
If this was helpful or correct, please be kind and remember to click appropriately!
Michael Jones - Proud member of the CloudPires team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!