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

How can send one email message for each issue returned by Lookup Issues?

I see many examples and questions regarding sending a single email message containing all the issues returned by the Lookup Issues action.

What I am trying to do is to send one unique email message to the assignee for each issue found by the Lookup Issues action.

Is this possible?

If so, examples would be very helpful, if available.

TY

3 answers

Hi @Ryan McBryde 

Unfortunately, there is no rule-defined looping structure yet for automation, to span the possible assignees.

I can think of two ways to do this if-and-only-if you have a defined list of possible assignees.

  1. Simple and fast, but maintenance heavy: Create a separate schedule rule for each possible assignee, with a specific lookup issues action (with JQL) for that person.  Type their email address directly in the TO field for the email.
  2. Complex, slow, and less maintenance: Create a single rule, using a branch (on a dummy issue) for each possible assignee, with a specific lookup issues action (with JQL) for that person.  Type their email address directly in the TO field for the email.  Please note: if you have a lot of possible assignees, this could run up against the limit for the number of components in a rule (64 total, I believe).

Best regards,

Bill

Hi @Bill Sheboy 

Thank you for the suggestion.  I did a little more digging and seem to have it working although it seems like I had to some redundant logic.  Feel free to critique my approach as I am new to using Automation.

The job is a scheduled job that runs every 3 days.

It runs a JQL search that looks for a list of issues that match my criteria.

The action that it runs is a "Lookup Issues" that runs the same JQL as the scheduled job.

Then I added a branch using the "Current Issue".

In the branch I run the same "Lookup Issues" job as above, with the exact same JQL.

Still in the branch, it uses the Send Email action and I can use the Assignee in the To: box.

Then the subject is "Issue {{issue.key}} requires review."

The body of the email looks like this:

{{issue.issueType.name}} issue {{issue.key}} in project {{issue.project.name}} with status {{issue.status.name}} assigned to {{issue.assignee.displayName}} requires review.

 

This sends a separate email for each issue that matches the criteria, with the issue key of each individual email in the subject and the fields in the body use the values from each of the issues found.

So, if I own 5 issues and my colleague owns 3, they will get 3 emails, one for each issue they own, and I will get 5, and each email will show the individual issue key and other values as shown in the body.

I'd love to trim it down a bit if I can get away with it, I figure one of the JQL searches is unnecessary, probably the one the Scheduled job, but this appears to work so I am going with it for now.

Hi @Ryan McBryde 

Sending one email for each issue is what @Mark Chaimungkalanont was also suggesting.  For that, you would just use the scheduled trigger with JQL, and use another other criteria with conditions before sending the email.  If that works for your team (getting multiple emails), you are done!

If that gets too noisy, you can try the other more complicated approaches to send one email per assignee.

There is a non-automation solution to this: filter subscriptions.  For that, you create a shared filter, and anyone can subscribe to get an email on their desired frequency.  Please look here to learn about that method:

https://support.atlassian.com/jira-core-cloud/docs/work-with-search-results/

Best regards,

Bill

Like John Funk likes this
0 votes
Benjamin Community Leader Apr 30, 2021

If you have Jira automation, you should be able to set a trigger, condition, and then action with send e-mail.

 

In the send e-mail action, you can select assignee and run your lookup issues.

 

See this link on an example how lookup issues is setup with the e-mail:

 

https://community.atlassian.com/t5/Automation-questions/Action-quot-Send-email-quot-with-quot-Lookup-issues-quot-cannot/qaq-p/1421143

 

Hope this helps.

Thank you Benjamin.  I should have been more specific.  I am working in the Jira Cloud and it uses the {{lookupissues}} smart value instead of {{issues}} as in the server version.  The problem I have with setting the assignee is that when Lookup Issues returns the list of matching issues, it won't let me set "Assignee" in the To: box of the "Send Email" action.  It continually complains that the "To:" field is empty, which makes me think that I have to somehow select the {{lookupissues.assignee.emailAddress}} in the To: box which works but sends me one email for all the matching issues found by Lookup Issues, and what I want to do is to send one email for each matching issues, even if they are to the same email address.   The link that you sent appears to be for Server and not cloud and I don't see anywhere in the example where the To: address is set and I have tried to use the cloud version of that code but it won't fire without a To:  Thanks though

I can use this:

{{#lookupIssues}}{{assignee.emailAddress}} {{/}}

In the header or the body of the email and it iterates through the list very nicely but when I try it in the To: box, it fails with this error:

Error sending email:Domain contains control or whitespace

 

I also tried branching after the lookup issues step to see if I could get it to iterate that way and it complains:

Can't branch rule as it requires issue(s) in the context for this option. More than likely you have a trigger that doesn't insert issues into the rule chain. e.g. Scheduled rule not running a JQL query. Creating an issue does not put an issue into the context, you have to branch on it directly.

0 votes

As a variation on what Bill suggested, could you use the "Scheduled trigger"? That allows you to specify a JQL and will run the rule once for each matching issue, so you can send an email for each matching issue

@Mark Chaimungkalanont 

I will try that but I think that I did try something similar originally and it complained that the To: field was empty, which I interpreted as not being able to extract the Assignee from the results of the JQL search.  I will revisit that.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

221 views 2 1
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