- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-09-2025 05:15 PM
解決済! 解決策の投稿を見る。
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-09-2025 08:47 PM
script I shared should work fine if you are using correct group name from sys_user_group table and also if there are users under that
small correction in the GlideRecord object
Here is the updated script with group name
javascript: var query; var grmem = new GlideRecord('sys_user_grmember');
gr.addQuery('group.name','test_group_name');
gr.query();
var usrIDs = [];
while(gr.next()){
usrIDs.push(gr.user.sys_id.toString());
}
query = 'sys_idIN' + usrIDs.join(',');
query;
If you want to use group sysId then use this
javascript: var query; var grmem = new GlideRecord('sys_user_grmember');
gr.addQuery('group','groupSysId');
gr.query();
var usrIDs = [];
while(gr.next()){
usrIDs.push(gr.user.sys_id.toString());
}
query = 'sys_idIN' + usrIDs.join(',');
query;
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
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-09-2025 07:34 PM
I believe you want to see users from the particular group
try this
javascript: var query; var grmem = new GlideRecord('sys_user_grmember');
gr.addQuery('group.name','test_group_name');
gr.query();
var usrIDs = [];
while(grmem.next()){
usrIDs.push(gr.user.sys_id.toString());
}
query = 'sys_idIN' + usrIDs.join(',');
query;
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
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-09-2025 08:44 PM
Thank you for your response.
I have set up the script you suggested but could not achieve it.
It seems to me that the reason is that I am filtering by group name.
Is it possible to achieve this by group sysid instead of group name?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-09-2025 08:47 PM
script I shared should work fine if you are using correct group name from sys_user_group table and also if there are users under that
small correction in the GlideRecord object
Here is the updated script with group name
javascript: var query; var grmem = new GlideRecord('sys_user_grmember');
gr.addQuery('group.name','test_group_name');
gr.query();
var usrIDs = [];
while(gr.next()){
usrIDs.push(gr.user.sys_id.toString());
}
query = 'sys_idIN' + usrIDs.join(',');
query;
If you want to use group sysId then use this
javascript: var query; var grmem = new GlideRecord('sys_user_grmember');
gr.addQuery('group','groupSysId');
gr.query();
var usrIDs = [];
while(gr.next()){
usrIDs.push(gr.user.sys_id.toString());
}
query = 'sys_idIN' + usrIDs.join(',');
query;
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
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
02-09-2025 09:28 PM
Thank you for marking my response as helpful.
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