Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JMWE Email Issue Post-function return email address on checkbox selection

I am attempting to use the JMWE Email Issue Post-function to email a notification to multiple users based on whether a checkbox value is selected. I currently have the following within the Email addresses Groovy box:

if (issue.getAsString("customfield_13571") == 'user1') {return ''}
if (issue.getAsString("customfield_13571") == 'user2') {return ''}
if (issue.getAsString("customfield_13571") == 'user3') {return ''}
else {return ''}

When I test this it will pass but will not actually return anything regardless of what checkbox value I have selected.

Any help would be greatly appreciated!

2 answers

1 accepted

1 vote
Answer accepted

Hi @Josh Pulda ,

Ok, I understand now.

Assuming you still want to send to one email address per checked checkbox, the code would then be:

<%= issue.get("customfield_13571").collect{
switch(it.value) {
case "user1": return "";
case "user2": return "";
case "user3": return "";
default: return "";
}.unique().join(",") %> 


Thanks, @David Fischer _Appfire_

This works perfectly!

1 vote

Hi @Josh Pulda 

for checkboxes, the value test is different. Please check the "Issue Fields" help tab at the bottom of the editor, then select your checkboxes field to see how to test the field value.

But in your case you seem to want to return multiple email addresses, one per selected checkbox, so the code will be different.

Also, the Email addresses option expects a Groovy template, not script:


Finally, are etc. email addresses of actual Jira users? If so, you should instead use the "Users from script" option with a script that returns one or more usernames instead of email addresses.

Let me know which case it is, and I'll provide the corresponding code.

Hi David, 

Thanks for clarifying. I am attempting to return an email address because I would like it to be that of a distribution list email outside of JIRA. To better explain my logic, I should have updated the checkbox values to be set to a generic group name such as group1, group2, etc. If the checkbox selection is equal to that of 'group1' then return a hard-coded distribution list email that corresponds to that group.

Hope this makes sense!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: Fine Software

Happy New Year, everybody! What better way to kick off 2022 than with a new Marketplace Partner Spotlight ✨ This month, we're getting to know Daniel Franz, co-founder of Fine Software. Fine Software ...

430 views 2 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you