Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

select random user from group

Deepthi13
Tera Expert

i want to select random user from a hard coded group, pls find below logic and suggest.

if it goes inside if it should consider approverList , if it goes else condition it should consider hard coded group and it should send approve randomly for any one person in group

 

  if (approverList.length == 0) {
approverList.push(gs.getUserID());
return approverList;
} else {
var group = new GlideRecord("sys_user_group");
group.addQuery("sys_id", "d0b0871adbf45780a167d6fa4b9619a0");
group.query();
if (group.next()) {
i=0;
for( )
return group;
}
}   

15 REPLIES 15

asifnoor
Kilo Patron

Hello Deepthi,

If the issue is resolved, kindly mark my comment as  a correct answer so that the question is moved to the solved list.