How to get all group name of current login user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2019 11:33 PM
Hi All,
I want to get all the group names of the current login user. instead of "GlideRecord" option i want to get the group name list.
I used the below script but return the sys id of all group name but i want to display value
var myGroups = gs.getUser().getMyGroups();
gs.info(myGroups);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2019 11:52 PM
Hello,
Try gs.log(gr.getDisplayValue()); or gs.log("Name:" +gs.getUser().getLastName());
Still you have any queries then feel free to ask.
Please mark correct & helpful; if it's useful to you.
Thanks & Regards,
Pooja Devkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019 12:21 AM
Hi
I want to get the group name not user name
i user this below script but its not working
var myGroups = gs.getUser().getMyGroups().getDisplayValue();
gs.info(myGroups);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019 01:36 AM
Did you tried the script provided below?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019 12:01 AM
Hi,
Please try this script to get all group names
var myGroups = gs.getUser().getMyGroups().toString().split(",");
for(var i=0; i< myGroups.length; i++){
var group = new GlideRecord('sys_user_group');
if(group.get(myGroups[i])){
gs.info(group.getDisplayValue());
}
}