I'm referencing this documentation on using Dynamic Control for sending emails, but I can't seem to get my script right.
I went on ScriptRunner > Create Listener > Send a custom email > Events set to "Issue Updated" > Condition and Configuration:
if (cfValues['Team']*.value.contains('Team A')){
mail.setTo ("john.smith@gmail.com")}
if (cfValues['Team']*.value.contains('Team B'){
mail.setTo("jane.smith@gmail.com")}
But when I select Preview, "Condition evaluated to false". It becomes true when I comment out jane.smith email. But my custom field is a single select list, and we have over 30 Teams. This email trigger doesn't need to go on a workflow since whenever a Team is updated, it can happen on any workflow status or transition. Do I need to make 30 custom listener scripts? Is there a way I can condense it to 1 script using the Dynamic Control?
I've looked at filter subscriptions as well, but they will not work for us.