Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2024 02:49 AM
I want to fetch names of users using background script who is having itil roles.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2024 02:58 AM
Hi,
Try this.
var records = new GlideRecord('sys_user_has_role');
records.addQuery('role', '<sys id of ITIL Role>');
records.addQuery('state', 'active');
records.query();
while (records.next()) {
gs.print(records.user.name);
}
-Anurag
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2024 02:58 AM
Hi,
Try this.
var records = new GlideRecord('sys_user_has_role');
records.addQuery('role', '<sys id of ITIL Role>');
records.addQuery('state', 'active');
records.query();
while (records.next()) {
gs.print(records.user.name);
}
-Anurag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2024 03:03 AM
Thanks @Anurag Tripathi
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2024 03:04 AM
Cheers mate!!
-Anurag