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.

How to grp.addQuery('group', 'sysid') on multiple sysid's

Joshua Comeau
Kilo Sage

How to grp.addQuery('group', 'sysid') on multiple sysid's

 

ex script 

//answer = ifScript();

//function ifScript() {
// var grp = new GlideRecord('sys_user_grmember');
// grp.addQuery('group', 'sysid');  //sys_id of group assigned to Approval - Group activity ??how to add more sysid??
// grp.addQuery('user', current.variables.supervisor);
// grp.query();
// if (grp.next()) {
// return 'no';
// }
// return 'yes';
//}

4 REPLIES 4

Saurabh Gupta
Kilo Patron

Hi,
Like below

 

grp.addQuery('group','IN','sysids') //where sysids are comma seperated sys_ids of records

 

 


Thanks and Regards,

Saurabh Gupta

@Saurabh Gupta  What is the 'IN" for?

Does not work for me it exlcudes the entire groups now and does not activate the approval that was selected by current.variables.supervisor

@Saurabh Gupta  

have the following script it now excludes the groups but also now does not generate the approval any ideas?

//answer = ifScript();

//function ifScript() {
// var grp = new GlideRecord('sys_user_grmember');
// grp.addQuery('group', 'IN','sysid','sysid');
// grp.addQuery('user', current.variables.supervisor);
// grp.query();
// if (grp.next()) {
// return 'no';
// }
// return 'yes';
//}