- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 03:40 AM
Hello,
I have tried getting group names from the sys_user_grmember table by querying through email of user.
However, I am getting sysids of groups of a user.
I have used the following client script.
Thanks in advance
Navya
..................Client Script.....................................................................
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var groups = [];
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user.email', g_form.getValue('email'));
gr.query();
while (gr.next())
{
groups.push(gr.group);
}
alert(groups);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2021 04:51 AM
Hi,
please use while(gr.next()) instead of if(gr.next())
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
‎01-20-2021 04:51 AM
Hi,
Thanks for the update
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
‎01-20-2021 04:51 AM
Hi,
please use while(gr.next()) instead of if(gr.next())
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader