Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Send a notification to a distro list when a multiple selection custom field has an specific value

Hi...I need to send an email to a distribution list anytime a multiple selection custom field, 'Scrum Team',is set to include value "Integrations". That would involves at Issue Created and at Issue Updated events. So I have done the following:

1) Created two custom system events: 'Integrations at Creation' (with Issue Created template) and 'Integrations at Edit' (with Issue Updated template)

2) Created a 'Fires an event when condition is true' for the Issue Created event with condition 'Integrations' in cfValues['Scrum Team']*.value and event 'Integrations at Creation'


1) In the Notification Scheme, for 'Integrations at Creation' event, where/how do I specify the outlook distro list I want to send the email to? I thought I could do it in the Single Email Address field but there is a note there stating that notifications will be sent only for Public issues, not my case, since we dont grant Browse Projects permissions to Anyone

2) How would the condtion for the listener associated with the Issue Updated be? I need to capture the 'Integrations at Edit' event only when Scrum Team field is set to include Integrations, and not every time the issue is updated and Scrum Team happened to include Integrations.


Thank you in advance

3 answers

Hi Jonny...Thank you for the hint...contains did the trick.

Thank you

Hi Tomas,

I have been working on this today and I think I have a solution that should meet all of your criteria. Just to re-iterate the two concerns that you have around using a custom email script listener are:

  1. Not being able to use a the default Atlassian email templates
  2. You didn't want the email to be sent every time someone updates the issue, just when the option was genuinely selected.


The way that I approached resolving this was to create two Custom Email Listeners. One for Issue Created event and one for Issue Updated event. I would normally recommend running them in one listener, however, if you run them in two, then you can reference the correct event template. I have also written a validation template for you that should stop it sending the emails if the value in the custom field has not changed:

Issue Created

The issue created event that I set up looked like this:

IssueCreate.PNGI used this validation script:

// ::.. Field Value ..::
def custfieldVal = cfValues.get('Scrum Team')

// ::.. Event Change Variables ..::
def oldVal = !changeItems ?: changeItems.first().get('oldstring')
def newVal = !changeItems ?: changeItems.first().get('newstring')

/* ::.. Check criteria ..::
 * Check that the custom field value matches expectation
 * and is coming from a genuine change and not an edit.
if (custfieldVal && custfieldVal.value
    && custfieldVal.value == "Integrations") {
    if (!changeItems 
        || (custfieldVal.value == newVal && oldVal != custfieldVal)) {
        return true
return false

and the following template reference:



Issue Updated

The issue updated event that I set up looked like:


I used the same validation script as in create and I used the following template reference:




Setting the listeners up this way should address both of your issues and allow you to get the desired outcome.

I hope this helps :-)

Hi Stephen...first of all let me thank you for your assistance...I really appreciate it.

I tried your suggestion and I have some questions...I will focus first in this reply only on the Issue Created listener to make things simpler...for the Issue Created listener I believe the condition can be simplified to be only like this:

'Integrations' in cfValues['Scrum Team']*.value

That will suffice I believe since when the issue is created for the first time and the Integrations value is part of the Scrum Team field then the email should be sent, so I think a condition like that would be enough, dont you agree?


My issue is still with the email template...what should I enter in the email template field, just copy and paste what you have, $helper."${"parseFile"}"("templates/email/html/issueupdated.vm") ?

By doing that, the email is being sent with a body of:



so what I am missing?


Thank you for your assistance!


Q:I think a condition like that would be enough, dont you agree?

A: You’ve made a good point here. I simply copied the logic over because it works for both created and updated. You could, for the Issue Created event ONLY just get the value, rather than validate previous values. You will NEED that logic for Issue Updated event, otherwise it will send the mail every time the issue is updated if the “Scrum Team” field is set to “Integrations”. This means that, even if the user updates the description, then it would still send an email.

Q:what should I enter in the email template field?

A: This is my bad. I had overlooked this as I thought it would just work. I’ve done some work and come out with what you need. I tested it myself and it loads the template correctly:

For Issue Created:


For Issue Updated:


Hope this helps :-)

Note: A couple more things that I forgot to mention. I set the "Email Format" field to HTML for the best looking output and set "Include attachments" to "All". This should attach the images required for the mail

Hi Stephen...thank you for your reply.

I am configuring the listener for the Issue Update event but I am getting some Static Type checking errors. I am attaching a picimage.png


Hi Tomas,

I had the same issue when I first added it, however, when I save and come back, those errors disappear.

Q: Does it work when you use it?

Hi Stephen...I have been testing it but it is not is not sending the email when it it working in your instance?

Hi Tomas,

I've tested it and it is working in my instance. Can you give me more detail about the issue? Is it sending the email sometimes but not others, or not at all? Do you have any errors in the logs? Can you send me screenshots of your setup?

Hi Stephen...thank you for your reply...I have an update on this but this site does not let me enter the answer...very weird...this site is acting up once again!

Hi Stephen...thank you for your reply...I have been doing more testing and it is not working...I think the first IF condition is quite not right...I used log.warn statements to see what values the IF condition is evaluating to and with those values the condition would evaluate to FALSE even when the condition should evaluate to TRUE....also, I noticed that you are using custfieldVal = cfValues.get('Scrum Team') as well as custfieldVal.value, but arent they the same thing? You wouldnt need custfieldVal.value since you actually already got the value from cfValues.get("Scrum Team") In this case oldVal was 21st Century TARDIS and then it was updated to be 21st Century TARDIS, Finish Line Execution, Integrations (newVal). In this case, the condition should evaluate to TRUE since Integrations is part of the Scrum Team field for the first time. However, the first IF condition as it is configured would evaluate to FALSE since custfieldVal.value == "Integrations" is FALSE (in fact, custfieldVal.value in this case is [21st Century TARDIS, Finish Line Execution, Integrations]

2017-06-09 00:19:13,193 WARN [utils.ConditionUtils]: custfieldVal is: [21st Century TARDIS, Finish Line Execution, Integrations]

2017-06-09 00:19:13,193 WARN [utils.ConditionUtils]: custfieldVal.value is: [21st Century TARDIS, Finish Line Execution, Integrations]

2017-06-09 00:19:13,193 WARN [utils.ConditionUtils]: oldVal is: 21st Century TARDIS

2017-06-09 00:19:13,193 WARN [utils.ConditionUtils]: newVal is: 21st Century TARDIS,Finish Line Execution,Integrations

Hey, Tomas. Can you perhaps provide an updated version of your code? It's a little hard to pick up from the thread exactly where the script is at this point.

I suspect that the issue here is that the "in" condition you have will work on the custom field value, as in

'Integrations' in cfValues['Scrum Team']*.value

But it won't work for the newVal variable because that's actually one string, as opposed to a list of Strings like 

cfValues['Scrum Team']*.value

The thing is, the "in" keyword in Groovy works as you'd expect for Collections and Arrays, but not for strings. 

assert !("butt" in 'Guess what? Chicken butt!')
assert 'Guess what? Chicken butt!'.contains("butt")

You can use the .contains method instead.


Again, if you can provide updated code and point to which if test is failing, that would be helpful.


Thank you both Stephen and Jonny!

1 vote

You can do this with the send a custom email listener under Admin -> Script Listeners -> Send a custom email. The events you need are issue updated and issue created. Which should handle point 1.

If you click expand examples under the "Condition and configuration" section and select for example "Has select list value equal to" you'll see how to get the value of a select list custom field. There's a few more examples there for different field types.

The email will only be sent when the condition is true, so this handles point 2.

Hope this helps.

Hi Adam...thank you for your reply.

For my question 1, I could use send a custom email listener instead of  Fires an event when condition is true listener, but one of the reasons I used the latter is because I wanted to use the default JIRA email templates for Issue Created and Issue Updated. So, how can use the send a custom email listener to send the email using the default JIRA email templates for Issue Created and Issue Updated? My understanding is that when using the send a custom email listener, I would have to create my own email template in field Email Template.

For my question 2, I used that condition,  'Integrations' in cfValues['Scrum Team']*.value, but my understanding is that that condition will evaluate to true every time the issue is updated and Integrations is in the value of my custom field and I dont want to send the email everytime the issue is updated and Integrations is in the value of the custom field. I need to send the email only when my custom field is set to have Integrations as value. For instance:

- Scrum Team = Web, Cloud and the user update Scrum Team field to be Scrum Team = Cloud, Integrations (send the email since Integrations was not a value of the Scrum Team field and now it is)

- Scrum Team = Cloud, Integrations, Web and the user updates Scrum Team field to be Scrum Team = Cloud, Integrations (do not send the email since Integrations was already a value of the Scrum Team field)

- Scrum Team = Cloud, Integrations and another field is updated (do not send the email since Integrations was already a value of the Scrum Team field)

My understanding is that a condition like  'Integrations' in cfValues['Scrum Team']*.value will send the email in all three above scenarios and I dont want that. I think the condition has to indicate that there was a change in the Scrum Team where Integrations was not part of the previous value and now it is and then send the email. I dont know how to write a condition like that.

Thank you in advance!




Suggest an answer

Log in or Sign up to answer

Atlassian Community Events