How can I script an email recipient based on the value of a variable

Cupcake
Mega Guru

I have a catalog item that has a variable (select box) that contains a list of names. In addition, I have an email notification baked inside of the workflow. What I am trying to do is send the email notification to person that is selected in that select box. Is this something that can be accomplished?

find_real_file.png

 

find_real_file.png

 

1 ACCEPTED SOLUTION

guruprasad1
Kilo Guru

Hi

 

Can try this

answer = [];

answer.push(current.variable.variable_name);

Regards

Guru

View solution in original post

16 REPLIES 16

Can you try:

answer = [];  

var arrAppr = current.variables.u_approver.split(",");

for (var i = 0; i < arrAppr.length: i++) {

 

    answer.push.(arrAppr[i].toString());

 

}

Can you try now:

answer = [];
var arrAppr = current.variables.u_approver.split(",");

for (var i = 0; i < arrAppr.length; i++) {
answer.push(arrAppr[i].toString());
}

I just tested this and it didn't work.

This is what I have inside of the workflow. So the expectation is that when the task is closed the Approval email will go to the following recipients:

a. Request - Requested For

b. Opened by

c. All the members of the Premier Comp Team

d. AND I want the email to also go to the person in that drop down select box. I think I know why it is not working because the variable is a select boxy. If I made it a reference field it would be able to pull back that person's email address.

 

The select box has to be reference field to get sys_id or email id, I forgot to ask that question.