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

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 + '');

 

}
 

wefw
Tera Contributor

Hi Shruti,

 

Thanks for the response.

Should we need to add the code  after 8th line which i have shared a screenshot?

 

No.. remove the existing code from activity and paste the above code I shared

wefw
Tera Contributor

Hi Shruti,

Code is Working.

But Requested for manager is not getting approval, if we removing our line. So we added that line in your Script. now its Working.

Thank you