I'm trying to use Jira global automation rules to loop over the labels on a specific task when it is created/updated. If the label name exists in a lookup table (departmentEmails), then append/contact the value to another variable called "toEmails". If the label does not exist in the lookup table, but it contains an "@ symbol, also prepend/contact the label name to toEmails".
I can not for the life of me get the lookup table to use departmentEmails.get(.) on the iteration of the labels. I've tried several ways, like this (using the THEN set variable command):
{{#issue.labels}}{{#if(departmentEmails.get(.))}}{{departmentEmails.get(.)}}; {{/}}{{/issue.labels}}
but that yields an error about the ".", which is the only way I know to access the current iteration in the nested loop.
I even tried not using the lookup tables, but I also get an error with this:
{{toEmails}}{{#issue.labels}}{{#if(equals(., "Marketing"))}}marketing@my-company.com; {{/}}{{/issue.labels}}
Can anyone come up with a better way to do this? I would use the BRANCH action on a smart value but I need to also do some if/then/else logic, and that can't be done within a branch. Thank you for your help.