I have a business requirement for multiple recipients on an email notification from a workflow. The recipients are to be selected from a multiple select field in the workflow instantiation window. I have been unsuccessful in passing the array of recipients to the email. I am using a solutions workflow and the iwmailbody.tpl and iwmailheader.tpl files in TS 5.5.2 on Windows.
I created a roles file and defined it inside template_script tags in the Workflow.
my($email_html) = get_names_from_file(undef, 5, "multiple",
"$roles/ecomm-email.uid");
In the Tag section I defined the multiple select drop down which appears correctly in the workflow instantiation window.
email =>
[ html => $email_html,
label => "email recipients",
error_msg => 'Please choose the email recipients.’,
],
I then defined $addresses
my $i;
for ($i=0; $i<__ELEM__('reviewer'); ++$i)
{
$add[$i] = "__TAG__(reviewer[$i])";
$addresses = join ",",
@add;
}
and inserted the variable in the external email task.
<variable key="addresses" value="__INSERT__($addresses);"/>
In the solutions email body file, I defined $addresses and output it to see what values I was getting, unfortunately I get nothing returned.
my $addresses = iwpt_dcr_value('dcr.workflowinformation.task[0].variables.variable[0]
@value');
Any assistance would be greatly appreciated.