You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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!
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(",") %>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.