GlideQuery() or condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2022 04:55 AM
Hi, My requirement is to search current logged in user in two groups using GlideQuery() only, For that I have tried like this.
var gr = new global.GlideQuery('sys_user_grmember')
.where('group','287ebd7da9fe198100f92cc8d1d2154e')
.orWhere('group','8a4dde73c6112278017a6a4baf547aa7')
.where('user',gs.getUserID())
.select()
.toArray(1);
gs.info(JSON.stringify(gr));
Please let me know if there is anything wrong.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2022 04:59 AM
Hi,
you can use this script
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery("user", gs.getUserID());
gr.addQuery("group.sys_id", "IN", "287ebd7da9fe198100f92cc8d1d2154e,8a4dde73c6112278017a6a4baf547aa7");
gr.query();
var isMember = gr.hasNext();
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-19-2022 05:02 AM
Hi,
I need that using GlideQuery() only. Please provide that answer using GlideQuery() only.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2022 05:01 AM
Hi,
check below links for help
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-19-2022 05:04 AM
based on that document only I written that code, but I am getting Error. Please correct that code.
Thanks