- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:00 AM
i know the group name using get() method how we can get that single group in group table
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:12 AM
simply use this
var groupName = 'Your Group Name'; // Replace with your group name
var groupGR = new GlideRecord('sys_user_group');
if (groupGR.get('name', groupName)) {
// Group found
gs.info('Group found: ' + groupGR.name);
} else {
// Group not found
gs.info('Group not found');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:06 AM
Hi @mani55
Could you please give more info on your requirement? It's unclear.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:12 AM
simply use this
var groupName = 'Your Group Name'; // Replace with your group name
var groupGR = new GlideRecord('sys_user_group');
if (groupGR.get('name', groupName)) {
// Group found
gs.info('Group found: ' + groupGR.name);
} else {
// Group not found
gs.info('Group not found');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:20 AM
anukur we can use below as well or not
var grpGR = new GlideRecord('sys_user_group');
grpGR.get('name','TEM Mobile Services');
assignement_group = grpGR.sys_id+'';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:34 AM
Yes, you can use if you are sure about the group name.