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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,465,985
Community Members
 
Community Events
176
Community Groups

Sending an email with a list of issues using Automation for Jira

Edited
Gil Rising Star Oct 01, 2019

HI.

I was following this guide: 

https://docs.automationforjira.com/issues/bulk-processing.html#smart-value-changes

 

The scheduled trigger is using a JQL to retrieve results.

In my example, there were 6 issues.

I received 6 individual emails instead of 1.

Each email had 1 unique issue in it.

I was expecting 1 email with 6 unique issues.

This is the email content I wrote:

The following issues require QA to R&D:

{{#issues}}
<a href="{{toURL}}">{{key}}</a> by {{assignee.displayName}}

{{/}}

resolved issues

What am I doing wrong?

 

10 answers

1 accepted

This doesn't work

@Gil @Sameer Bansal But this does:

I have an automation whose trigger is: Run every day at 9am

Step1: The first step in the automation is to use the new lookup issues action by adding a "component: new Action" and select "Lookup Issues". Inside the lookup issues construct, add the JQL query you need (e.g., Issuetype=Bug, Status = Open ...)

Step2: Send a simple email with the following in the body of the email:

List of issues:

{{#lookupIssues}}
<a>{{key}}</a>
{{/}}

 

The email provide a simple list:

TD-3099
TD-3064
TD-2970

Like # people like this

@Bill Glynn This worked beautifully! Thank you very much!

Like # people like this

Hey @Derek Kelsheimer I'm glad it worked for you!

Hello @Bill Glynn ,

 

thank you this worked.

@Karthiga Sethuraj You have to use {{#lookupIssues}}. Looks like you're missing the #.

Like John Funk likes this

oh yea I just realized that. facepalm!

Like # people like this

Thanks @Bill Glynn - you are a lifesaver! Had the same issue and I did:

1. When: Scheduled

2. Action Lookup Issues with the JQL of "Est. Due Date" <= 14d

Note: Est. Due Date is a custom field we made for our project tickets.

3. Send email

works like a charm.

Hi @Bill Glynn ,

Thanks for this recommendation.

What is the syntax to include all columns in the view? e.g., Summary, Assignee, etc..

I mean, in a nice formatted columns.

Or is it possible now to have an attachment to an email automation?

Thank you for this! I created a 'scheduled' version of this rule that runs once a day, but sometimes I have 0 issues and the email notification still gets sent. 

 

How can I edit this rule so that it sends ONLY when there is at least 1 issue, and NOT send when there are 0 issues? 

 

TYIA. 

John Funk Community Leader Dec 23, 2022

Hi @Joseph Green  - Welcome to that Atlassian Community!

Can you share the JQL you use in the Scheduled Trigger? It should not finish executing the trigger if your JQL returns no results. 

Thanks @John Funk ! My rule runs as so - 

1. When: Scheduled - everyday at 8:30am (no JQL here)

2. Action Lookup Issues with the JQL of "project = WinterProject AND assignee = Empty AND status not in (Blocked, Closed)"

3. Send email: 

{{#lookupIssues}}

* Issue Key: <b>{{key}}</b> (<a>{{url}}</a>)
* Summary: <a>{{Summary}}</a>

{{/}}

John Funk Community Leader Dec 23, 2022

Do you have the JQL embedded in the initial trigger itself?

Screenshot.png

I do not have the JQL embedded in the initial trigger, I just have the schedule trigger run and then in the next action 'LookUp Issues' is where I run the actual JQL. 

It currently is setup as - 

 

1) When: Scheduled - everyday at 8:30am

2) Then: Lookup Issues - search for issues using JQL "project = WinterProject AND assignee is Empty AND status not in (Blocked, Closed)"

3) And: Send Email - 

Hi -

Please see the list of issues still unassigned as of 5:30pm CET / 11:30am EST today.

<b><u>List of issues:</u></b>

{{#lookupIssues}}

* Issue Key: <b>{{key}}</b> (<a>{{url}}</a>)
* Summary: <a>{{Summary}}</a>

{{/}}

 

Hi @Joseph Green 

You can add a Condition after the "Lookup" Action

This worked for me:

  • Trigger: Scheduled
  • Action: Lookup Issues
    • JQL = <Query here>
  • Condition: Advanced Compare Condition
    • First Value = {{lookupIssues}}
    • Condition = does not equal
    • Second Value = Empty
  • Action: Send email

^ The audit log will still show the rule as succeeding, as it does activate the first Action. But it won't activate the second one (i.e "Send email") if it doesn't meet the Condition.

Ste

Like John Funk likes this

Hi @Gil ,

I'm a support analyst of Automation for JIRA Support Team.

Firstyl, it is important to have in mind that the bulk handling of issues or bulk sending e-mails is not available for JIRA Cloud (we have this issue for tracking the development of this feature for Cloud: https://codebarrel.atlassian.net/browse/AUT-888).

So if you are using a JIRA Cloud, you cannot perform that action. And if you are using a JIRA server, you'll need to check the "Process all issues produced by this trigger in bulk" option under your "Scheduled" trigger under "More options", as shown in the image below:

Screen Shot 2019-10-02 at 10.22.04.png

Hope that information helps you.

But please let me know if you got any further questions.

Cheers,

Victor

Gil Rising Star Oct 02, 2019

ok, that explains it. 

we use cloud and don't have that option.

 

Thanks for the info!

@Victor Seger when this will be released?

Like # people like this

@Victor Seger Our team would also love to have the "Process all issues produced by this trigger in bulk" option available in JIRA Cloud as well.

Do you have an ETA for that?

Thanks!

Like # people like this
Daniel Eads Atlassian Team Apr 30, 2020

Hey all,

The feature request for bulk processing of issues in Cloud was transitioned from "Backlog" to "In Progress" on April 22. We're hoping to have this available soon, as noted in this recent article 79 Questions and Answers about Jira Automation .

If you want to keep a closer eye on the progress of this feature, you can see its current status on this issue: AUT-888 

Cheers,
Daniel

Like # people like this
John Funk Community Leader May 01, 2020

Awesome - thanks, @Daniel Eads !! Is there any way to be a Watcher on that to get updates automatically?

Daniel Eads Atlassian Team May 14, 2020

The Codebarrel Jira from before the merger into Atlassian (AUT tickets) doesn't have watching enabled. Any new bugs or feature requests around Automation are being filed in jira.atlassian.com now. The team is moving pretty quickly through the AUT tickets, so there will be less of these over time and the ones that you see most frequently around Community now are likely the ones to be closed out first.

Like John Funk likes this

Hi @John Funk , @Albert Alemany , @qais_alkhateeb 

I just noticed AUT-888 was moved to "Done" today - just for your information :)

Ste

Like # people like this
sreuter Atlassian Team Jun 02, 2020

The feature is now in production, you can search for "lookup" in available actions! More documentation following soon!

Like John Funk likes this
Gil Rising Star Jun 02, 2020

Thanks for the update. In the meantime I'm using JQL subscriptions.

sreuter Atlassian Team Jun 02, 2020

No worries! Here's an example for you if you wanna try it right away:

1. Setup scheduled trigger

2. Select "Lookup issues" as the action and put in your JQL

3. Setup email action which can now access the data from the looked up issues (example is from when using "release version" trigger)...

Subject:

So much goodness, we just released awesome app v{{version}}

Content:

<ul>
{{#lookupIssues}}
<li>{{key}} - {{summary}}</li>
{{/}}
</ul>
Like Gil likes this
Gil Rising Star Jun 03, 2020

Thanks. That's quite helpful!

Is there a way to use that to pass a list of issues in a Slack message?

Like sreuter likes this

Right now it only puts the issue.key in the body if I use {{lookupIssues}}.

sreuter Atlassian Team Jun 03, 2020

@Gil Yes, you can achieve this by adopting like the example above for your purpose.

@Tom De Blende Did you see the example above? The # is important when using the smart value provided by the lookup issue action step.

Like Gil likes this
Gil Rising Star Jun 03, 2020

Thanks @sreuter 

Last thing, for JSD and SLA, is it possible to access the Time to Resolution in the list and present how many hours/minutes left to breach SLA?

Example:

{{#lookupIssues}}
• {{key}} - {{summary}} - in {{"Time to resolution"}}
{{/}}

In my case the TTR is:

customfield_12230": {"id": "1","name": "Time to resolution",

I'm not able to make it work.

@sreuter Works like a charm! Thanks!

Like sreuter likes this
sreuter Atlassian Team Jun 04, 2020

@Gil How does your smart value look like to access the customfield?

Gil Rising Star Jun 08, 2020

I used the customfield variable as a smart value but that didn't work. It didn't list how many hours to breach SLA.

@Victor Seger @sreuter This works great. However: how can I abort an automation if lookupIssues is empty before sending out a message? I wasn't able to create a working size check on this.

JRACLOUD-75698 raised by support to add the bulk feature back on a scheduled automation folks, if you would like to watch/vote. 

While LookupIssues is useful, if it finds no issues it will cause the automation to error, which can be undesirable and noisy. 

By contrast, using the JQL constraint on a scheduled task will pass the automation, with "no actions performed". 

Like Sven, we would like to be able to assess the return without the automation failing. Thanks!

3 votes
Gil Rising Star Jul 20, 2020

 

 

@sreuter I think there's a bug with the list function.

I use it in a rule to publish a list of issues, based on some trigger, in an email and slack channel.

The list is being published multiple times, say 20 times in slack and 20 emails, all are the same.

Would love to know if I can get on call with you with remote to share with you the problem as it's too complicated to explain over a text.

 

Thanks,

Gil

Did you ever figure this out? I know this is super old, but what I found is that in the Trigger section of the Scheduled option, there was a checkbox for "Run a JQL search and execute actions for each issue in the query.". If I had this checked, then I got multiple emails. So I unchecked it and captured my result set using an Action called "Lookup Issues". Then I added another action to send the email.

Doing this gave me a single email with a list of issues that I was expecting.

So I have a question. My customers are receiving the email with a list of issues, however, if those issues are tied to different approvers, it just sends a list and they have to figure out which issue is tied to which approver. Is there a way to specify which issue goes to which manager?

John Funk Community Leader Aug 16, 2022

Hi Camilo,

You should open a new question on Community so more people will see it. 

First thought though is that you could add a Condition for each approver. 

Like Rabbit Stoddard likes this

We did something similar just like John said with separate conditions for each person that received the email so they only saw the items they needed to see. It's part of the JQL in the Lookup Issues automation component. Once you have it setup like you want, you can easily copy the rule, and then adjust things like the JQL and possibly the email copy, if needed.

Additionally, you can add a column for the approvers to be listed. Then everyone can easily see if the issues are for them or not. That also opens up the option to sort by that column, but if there are multiple approvers, then that might not work as expected.

I am unable to email the list of issues after branching them (and I have selected the 'Process all issues produced by this trigger in bulk' option in branch as well). Still getting individual email for each issue rather than a bulk email for all the issues as per the branch rule.

Have used the below smart value in the email body.


{{#issues}}
<a href=/{{key}}">{{key}} - {{summary}} | {{status.name}} </a>

{{/}}

Can anybody help me in this case?

Hi everyone,

I'm running into an issue using this feature as well. 

I have tried every variation of the {{lookupIssues}} templates shared on this thread, yet the body of the email always comes up empty.

Any assistance getting this bulk email rule to work would be greatly appreciated!

Thanks!Screenshot from 2021-04-30 15-36-05.pngScreenshot from 2021-04-30 15-36-18.png

Hi @Allison ,

Looks like you're close - you just need to add the actual lookup action as a component in your actions before trying to send the email.

I've taken the screenshot below from the "Post weekly MS Teams message with all newly created issues in Jira" rule in the Automation playground that you can use as a reference for what we're talking about here.

In your current rule, you've got a JQL search in your "When" trigger. This runs the rule each time for all the issues that turn up in the search. If the search matches 20 issues, it will try to run the actions 20 times.

What you want to do is add a Lookup Issues action between your "When: Scheduled" and "Then: Send email" components. This Lookup Issues rule will actually populate the {{lookupIssues}} array that is used in the email:

image.png

This also means that you can remove the JQL search from the "When" component, as you'll actually be fetching the issues as part of the Lookup Issues component.

 

Let me know if you're able to get that modified and working, or still need some assistance!

Cheers,
Daniel | Atlassian Support

Daniel Eads Atlassian Team Apr 30, 2021

Disregard - I see you've also opened a separate question where you mention you're on Server and the Lookup Issues action is only for Cloud. Looks like Bill was able to help you out on that question. Cheers!

0 votes
Gil Rising Star Sep 28, 2020

Anyone who's following this thread, there's a bug with the Lookup action.

It re-iterates on itself and will publish the same notification multiple times.

Say you have a list that contains 3 items, using the Lookup action, if you post a slack message or an email, it will send 3 notifications containing the 3 items.

A 2nd bug is that the Lookup will cause notifications to be published even if the list is empty.

 

I found a really dodgy workaround for my use case.

I wanted to notify my team via slack when Jira issues are stuck In Review for more than 24 hours. Post a slack message with the list of the Jira issues and Flag those issues. If no Jira issues are found, don't post anything.

Using the Branch function and IF conditions are helping.

image.png

Notice how I have to repeat the JQL for this to work.

Instead of using the JQL with the cron. If you use the JQL with the cron, you'll get that issue I mentioned.

John Funk Community Leader Sep 30, 2020

Thanks for sharing @Gil ! How are you populating "status time"?

Hi @John Funk 

It's a custom field I created in Jira.

I then use another automation rule to populate it with {{now}} each time a jira issue is transitioned to some status.

This allows me to count the time a given issue is in a given status.

I use this field quite extensively in many other automation rules and I don't understand why it's not baked in Jira.

The Updated field is not good for my usage because any change which is not a transition, re-stamps the time value in that field.

Hope it helps.

Like John Funk likes this

@Gil Neither of these are bugs with lookup issues. They're problems with your rule. If you were using the JQL with your CRON as described that would explain why you were getting multiple notifications because it then runs for each issue returned. There's no need to run the CRON with JQL, just run without and immediately do lookupIssues.

As for it sending a notification even when lookupIssues is empty, that's down to the fact that you are blindly throwing it into your Slack notification. If you don't want it to do that you need to add a condition before sending your Slack message. In one of my rules I send a different message when there are no issues or you could just choose to do nothing. If you just add an advanced compare condition looking for {{lookupIssues.size}} is greater than 0 before your Slack notification, that will do the trick.

As you clearly want to do two different things here (slack notification of a list and flagging each issue) I'd suggest that you either split it into two automation rules or you could just move the lookupIssues portion to the top (with no JQL in the CRON). So long as it's before your branch rule it should only trigger once.

I'm not sure why you've added the comparison on the same JQL you're using in your lookupIssues. Were you trying to check if there are issues returned? If that's the case, use the comparison I specified above after lookup issues but before your Slack notification

Like Oana PETCU likes this
Gil Rising Star Dec 03, 2020

Hi mate, thanks for the detailed reply. I figured where I was wrong with the help of A4J great support.

Your comments are on point.

0 votes

This and many other use-cases can now be achieved via the newly release "lookup issues" action. Documentation is available at: https://support.atlassian.com/jira-software-cloud/docs/automation-actions/

Example

1. Setup scheduled trigger

2. Select "Lookup issues" as the action and put in your JQL

3. Setup email action which can now access the data from the looked up issues (example is from when using "release version" trigger)...

Subject:

So much goodness, we just released awesome app v{{version}}

Content:

<ul>
{{#lookupIssues}}
<li>{{key}} - {{summary}}</li>
{{/}}
</ul>

 

John Funk Community Leader Jun 25, 2020

Hi @sreuter  - I tried the above documentation but it is a little misleading. The trigger returned nothing if I used issue. and the name. (Also the documentation has an (INSERT SCREENSHOT HERE) prompt but no screen.  ;-)

So what ended up working for me was this:

<ul>
{{#lookupIssues}}
<li><a href="{{url}}">{{key}} </a> | {{created.longDate}} | {{status.name}}</li>
{{/}}
</ul>

I wanted to also use priority but could never get that to work. It's not in the documentation, but figured it might work since it is a standard field in Jira. Any thoughts there? 

John Funk Community Leader Jul 16, 2020

@sreuter  - any update on this one?

Hi @John Funk

I tried both your smart value suggestion as well as one listed above and I keep receiving blank emails.

The rule says it was successful, and I do receive one saying "Hello!" as my greeting, but no issues are listed even though I show 3 that should. 

Like Rabbit Stoddard likes this

@Lesly Cracchiolo I'd love to help you as I have a few of these automations working correctly with both emails and Slack notifications but I can't really give you any pointers without knowing what your rule looks like or what you're trying to put in the content of your email. Screenshots of those would be useful if you'd like help

Like # people like this
John Funk Community Leader Dec 04, 2020

Agreed - screenshots are super helpful  :-)

John Funk Community Leader Dec 04, 2020

Try putting the word issue in front of created and status {{issue.created.longDate}} and {{issue.status.name}}

I'm having the same problem... I also tried it with {{issue.status.name}} and all and it didn't work. But it looks like it's all set up right: 

Screenshot 2021-02-16 142244.pngAnd this below is the email I'm getting:

 

Screenshot 2021-02-16 142258.pngAnd this is the log with the results of the query:Screenshot 2021-02-16 142319.png

 

Any ideas?

John Funk Community Leader Feb 16, 2021

Looks like you are missing the <ul> part

This is what works for me:

{{#lookupIssues}}
* <a href={{url}}>{{key}}</a>: {{summary}} -- {{Story point estimate}} points ({{status.name}}, {{assignee.displayName}})
{{/}}
Like # people like this

Hi @Gil, do you have the bulk processing option active?

Gil Rising Star Oct 02, 2019

Can't find where to enable it.

Like Jacob Golder likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events