Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 'user1@email.com'}
if (issue.getAsString("customfield_13571") == 'user2') {return 'user2@email.com'}
if (issue.getAsString("customfield_13571") == 'user3') {return 'user3@email.com'}
else {return 'other@email.com'}

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 "email1@acme.com";
case "user2": return "email2@acme.com";
case "user3": return "email3@acme.com";
default: return "email4@acme.com";
}
}.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:

image.png

Finally, are user1@email.com 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
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New cloud apps roundup - June 2021

Since our last roundup in April, Atlassian's Marketplace Partners have added over 100 new cloud apps to the Atlassian Marketplace to help your teams work more efficiently. Let’s take a quick look a...

425 views 5 12
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