Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to get users who is having itil role using backgeound script

VyankteshK
Tera Contributor

I want to fetch names of users using background script who is having itil roles.

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron

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

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron

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

Thanks @Anurag Tripathi 

Cheers mate!!

-Anurag