Send email to unique email address based on the random selections made in multi-select custom field

VVC
Contributor
March 3, 2025

Would it be possible to setup an automation rule for sending an email to an unique email address for each option(s) selected randomly in a multi-select choice custom field in Jira DC?

I have a multi-select choice field "tags" with 10 option values in a Story issue type. Now whenever user makes a selection either one value or multiple values then Automation should send out an email accordingly.

Custom field name: Tags

Options: A, B, C, D, E, F, G, H, I, and J

Corresponding Emails: Option A -> A1@gmail.com, Option B -> B2@gmail.com, Option C-> C3@gmail.com, Option D -> D4@gmail.com, Option E -> E5@gmail.com, Option F -> F6@gmail.com, Option G -> G7@gmail.com, Option H -> H8@gmail.com, Option I -> I9@gmail.com and Option J -> J10@gmail.com

My current automation rule is not working as expected.

Trigger: Field Value changed

If Condition: tags equals A then send email to A1@gmail.com

Else if: tags equal B then send email to B2@gmail.com

and so on till Else if: tags equal J then send email to J10@gmail.com

This automation rule works only for a single selection in tags field and if I select more than one value then this rule fails obviously. Now rather listing all combinations and permutations inside this if condition loop, would it be possible for automation rule to send all corresponding emails for any number of options selected inside the tags field randomly?

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 3, 2025

Hi @VVC 

First, here are some questions to clarify the scenario you are trying to implement:

How many different email body contents are there: one to send to everyone or a different one for each recipient?

When do you want to send the emails?  That is, every time the field changes send an email to each selected recipient, or something else?

What does the "random selections made" mean?  Do you mean any values could be selected, or that there is some actual randomizing happening?

 

Until we know the answers to those questions...

With the if / else block in rules, one-and-only-one of the choices is selected.  It does not process each entry which meets the criteria.

Jira Data Center's version of automation does not support the Lookup Table or Advanced Branch features yet.  Thus your workaround options depend on the answers to the questions above.  A couple of options are:

  • When there is a different email body for each recipient, this makes for a long rule, with branching added: branch to current issue, test the field with a condition, send the email.  That is repeated 10 times.
  • When there is one email body which is sent to multiple recipients, try a conditional expression with list iteration to create the list of recipients in a variable.  Then send one email to them all.

 

Kind regards,
Bill

VVC
Contributor
March 3, 2025

Thanks @Bill Sheboy  for asking these questions and see below for my response. Please let me know if this helps further to draw a concrete solution.

How many different email body contents are there: one to send to everyone or a different one for each recipient?

VVC: About 7 option values has same email body contents, while the remaining 3 option values have different and unique email body contents. Each recipient is different, so each one has unique email address. In other words, 7 recipients has same email body contents, while the remaining 3 recipients has different email body contents.

When do you want to send the emails?  That is, every time the field changes send an email to each selected recipient, or something else?

VVC: Email(s) should be sent out to each unique recipient as soon as the field value changes in the ticket.

What does the "random selections made" mean?  Do you mean any values could be selected, or that there is some actual randomizing happening?

 VVC: Any value or multiple values could be selected randomly based on the internal business process on this multi-select choice custom field called tags.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 3, 2025

Based on your answers, the rule could use first approach I described with branching.  For example:

  • trigger: field value changes
  • branch: on current issue
    • condition: the field contains "value A"
    • action: send the email to A's recipient
  • ...repeat for all of the possible values

 

As I noted earlier, this would send an email to each selected value's recipient every time the rule runs.  If you instead only want to send the email once, some indicator must be saved (such as with another field) to detect the email was already sent.

VVC
Contributor
March 4, 2025

Bill, I have been trying few different ways to get this working and if I remember correctly, the condition field contains "value A" works which sends the email once. But when selecting multiple values randomly either during the ticket creation or ticket update operation, the emails to the individual recipients doesn't work.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2025

The trigger for field value changes only fires when an issue is updated.  When you want the emails for Issue Created also, the rule will need to be duplicated to use that trigger.

 

For an issue update which does not send the correct emails, you would need to research that for each case to determine the cause.  Note that if you leave the field when selecting the values, that will trigger the rule each time the field changes.

And once again, without seeing images of your complete rule and the audit log details, these are just guesses.  I recommend trying what is described above to learn what helps.

VVC
Contributor
March 6, 2025

The if, else condition with Advance compare two values seems like a good fit so far. I would also like to extend the automation to stop sending email if a pre-existing option is unselected at any point. Is there a way to stop the notification, if an existing option is unselected?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events