- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2018 09:56 PM
Hi,
How to get my all groups in scoped application.
I am getting error below
Server JavaScript error Cannot find function getMyGroups in object com.glide.script.fencing.ScopedUser@1ac4a90.
I am writing an encoded query to get my group is there any way to solve above error and get my groups.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2018 12:02 AM
Hi Komal,
Have this custom function to get the groups for the user:
var uID = gs.getUserID();
var groupArr = [];
var grmember = new GlideRecord('sys_user_grmember');
grmember.addQuery('user', uID);
grmember.addQuery('group.active', true);
grmember.query();
while(grmember.next()){
//Push the group sys_id values into the group array
groupArr.push(grmember.group.toString());
}
the array when you print will tell you the groups to which user belongs.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
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
08-07-2019 03:08 PM
Hi Ankur,
How do I get all the users from those list of groups (groupsArr)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2019 12:12 AM
Hi,
The getMyGroups() has been fixed in the new Madrid Patch 6, so now it should work fine also in scoped applications,
Please refer to the PRB1347170 (https://docs.servicenow.com/bundle/madrid-release-notes/page/release-notes/quality/madrid-patch-6.ht...)
If I have answered your question, please mark my response as correct and/or helpful so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2019 06:15 AM
We just upgraded to patch 6 over the weekend. getMyGroups doesn't even seem to be supported at all from scoped gs.getUser().getMyGroups()... Though I do see in the related problem where it calls it out.
It contains isMemeberOf, but that is it.
On top of this issue, I was hoping to us (Dynamic) encoded query, but that is also not supported from scoped applications, ug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2019 12:17 AM
Well that sucks... I got all excited about Alberto's comment and patch 6 (we're currently on 4b of Madrid), only to hear your story. 😞
Yeah, that link you provided doesn't mention getMyGroups(). <sigh>...
Is anyone else running patch 6 or greater for Madrid and successfully using gs.getUser().getMyGroups() in a scoped app?
