Send approval to users manager in list collector

wefw
Tera Contributor

I have a variable with list collector type with user table when we select multiple users in a variable then approval should send for those users Managers.

wefw_0-1730798759571.png

 

Present approval is going to only Requested for manager as below. we need to send approval to above selected users manager as well.

wefw_1-1730798983795.png

Any lead will be helpful

1 ACCEPTED SOLUTION

Shruti
Mega Sage
Mega Sage
answer = [];
var usr = new GlideRecord('sys_user');
usr.addEncodedQuery('sys_idIN'+current.variables.<listcollectorvarriablename>);  //replace with list collector variable name
usr.query();

 

while (usr.next()) {
    if (usr.manager)
        answer.push(usr.manager + '');

 

}
 

View solution in original post

5 REPLIES 5

Chaitanya ILCR
Mega Patron

Hi @wefw ,
Try this out

var usrGr = new GlideRecord('sys_user');
usrGr.addQuery('sys_id', 'IN', current.variables.select_users); //replace your variable name
usrGr.addNotNullQuery('manager');
usrGr.query();
while (usrGr.next()) {
    answer.push(usrGr.getValue('manager'));
}

 

Regards,
Chaitanya