- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 03:48 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 04:04 PM
Hi Deepak,
If you want to check on Server side i.e Business rule, background script, scheduled job etc. then here is the script.
var gr = new GlideRecord('sys_user_grmember'); // Table stores the mapping of user and group.
gr.addQuery('user', '<sys_id_user>'); // replace <sys_id_user> with actual sys_id of user.
gr.addQuery('group', '<sys_id_group>');// replace <sys_id_group> with actual sys_id of group.
gr.query();
if(gr.next()){
gs.info("User is Member of Group!");
}
else{
gs.info("User is Not a Member of Group!");
}
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 03:56 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 04:04 PM
Hi Deepak,
If you want to check on Server side i.e Business rule, background script, scheduled job etc. then here is the script.
var gr = new GlideRecord('sys_user_grmember'); // Table stores the mapping of user and group.
gr.addQuery('user', '<sys_id_user>'); // replace <sys_id_user> with actual sys_id of user.
gr.addQuery('group', '<sys_id_group>');// replace <sys_id_group> with actual sys_id of group.
gr.query();
if(gr.next()){
gs.info("User is Member of Group!");
}
else{
gs.info("User is Not a Member of Group!");
}
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2020 09:54 PM
Hi Muhammad,
we don't have sys_gr_member such table. it should be sys_user_grmember.
Have a great day.
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2020 04:52 AM
Hi Dhanajay,
Thank you for pointing out. It was a typo. Script is updated!
Have a great day too 🙂
Thanks & Regards,
Sharjeel
Muhammad