- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 02:35 AM
Hi All,
When I write any code using the code editor of ServiceNow, I do not see the function getMyGroups() being suggested automatically after I type in gs.getUser(). does this mean that ServiceNow does not suggests us to use that method? I can still see that it is working for now.
Thanks,
Kannan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 02:42 AM
Hi,
if a fucntion is not showing in the code suggestion, it does NOT means that this function cannot be used in the Javascript Code, you just need to be sure that you're using it in a server side script and NOT in a client side script.
Hope this will clarify your doubt.
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
11-11-2019 02:38 AM
Hi Kannan,
You can use this method anywhere on the serverside code. It returns the array of sys_id , of groups, logged in user is member of.
-Anurag

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 02:42 AM
Hi,
if a fucntion is not showing in the code suggestion, it does NOT means that this function cannot be used in the Javascript Code, you just need to be sure that you're using it in a server side script and NOT in a client side script.
Hope this will clarify your doubt.
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
11-11-2019 02:43 AM
Agreed with @Anurag.
just want to add here.
gs.getUser().getMyGroups() : It will return you the array list of groups, where current logged in user will be member of those groups.