Approval from a Variable

alexcharleswort
Tera Expert

I am currently working on a workflow and messing around with some approvals. In my form, I have the user fill out a "who is your manager?" field from a reference. I want to, then, have the approval task pull from the field they filled out in the form and email that specific manager for approval. Thoughts/ideas?

1 ACCEPTED SOLUTION

Hi Alex,



In the approval activity, check the advanced checkbox and put the following in the script field. You're pushing two user ids to an array for the approval activity to use.



answer = [];


answer.push(current.variables.manager.sys_id);


answer.push(current.variables.div_dir.sys_id);


View solution in original post

11 REPLIES 11

Ritu2
Tera Contributor

Hi all, 

I have a similar requirement where in the approval should go to a variable manager ( variable name - instead of going to the requester opener manager.

 

example A opened the request for B and B"s manager is C
So approval request should go to C/

 

I know that I have to write a script in user activity advance section but not sure what it is .

I tried below 2  but did not work 

=answer = [];


=answer.push(current.variables.requested_forPoweshell.sys_id);

=======

answer='';

if(curent.variables.requested_forPoweshell)
{

answer=current.variables.requested_for.manager.toString();

}

 

find_real_file.png

 

find_real_file.png

Ritu2
Tera Contributor

Hi all, 

I have a similar requirement where in the approval should go to a variable manager ( variable name - instead of going to the requester opener manager.

 

example A opened the request for B and B"s manager is C
So approval request should go to C/

 

I know that I have to write a script in user activity advance section but not sure what it is .

I tried below 2  but did not work 

=answer = [];


=answer.push(current.variables.requested_forPoweshell.sys_id);

=======

answer='';

if(curent.variables.requested_forPoweshell)
{

answer=current.variables.requested_for.manager.toString();

}

 

find_real_file.png

 

find_real_file.png