Need find user's with role (itil) via script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2013 04:16 AM
Hello,
I cannot find here how to get list of user's from database which have ITIL role.
I have seen element g_user.hasRole , but this work only on Client side.
I need find way how to build script with GlideRecord to be able query sys_user table via Script Background
I have my script below.
Can someone experienced in script's help please.
I tried several examples with gs...... but nothing work and I cannot find how to include query in C variable that user have itil role.
I tried add query in below script as------- c.hasRole('itil'); -------c.addQuery('sys_user','hasRole','itil');
I very appreciate whichever help and advice
Thank you
Petr
var c = new GlideRecord('sys_user');
c.addQuery('first_name','CONTAINS','Pe');
c.orderBy('fist_name');
c.query();
while (c.next()) {
gs.print(c.email)
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:04 PM
Thanks ravi1.tandon . Its an awesome filter condition you provided.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2019 07:38 AM
Silly question but could someone provide on opposite query operator if I wanted to find users that do not have the itil role?