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
Community Members
Community Events
Community Groups

create automation task to send email when certain number of issues are created.


I'm currently using an add-on named Automation for JIRA in order to create the following automation rule:

When an issue is created, I want to check how many issues were created for this project and if there are more than 10, send an email out.

The trigger will be when the issue is created and I select new condition. What I want is for this section to check how many issues are assigned to the project. But I'm a bit stuck. I was wondering if there is JQL code that checks how many issues are created? For example, in SQL, I would type in something like:

SELECT COUNT(*) FROM Issues WHERE (condition).




4 answers

2 accepted

1 vote
Answer accepted
Darryl Lee Community Leader Sep 27, 2021

Because you mentioned using an add-on named Automation for JIRA, you're probably running on Jira Data Center or Server, because in Cloud (which is what you've tagged your question), Automation is built-in.

Automation for Data Center and Server is very similar to Cloud, but as you discovered, it does not have a Lookup Issues action.

However if you are ok with there being up to a 24 hour delay in your notification, you could create a Scheduled trigger that runs every day, doing a JQL search as pictured in the documentation here.

You would want a query like:


In Server, the count returned by the JQL query would be accessible via the Smart Value {{issues.size}}, as documented here.

But as @Bill Sheboy correctly points out, you might run into a limit on the number of issues returned.

I'm a little unclear as to your intent though.

You want a one-time notification when this project has > 10 issues?

So like this?

Screen Shot 2021-09-27 at 9.06.45 PM.png

I mean, if you implemented that rule, for every issues beyond the first 10, you would get an email.

That's probably NOT what you want.

Are you looking for an email for something like an email for every 10 new issues?

Then you probably would need to do some modulo operation.

The other thing I was thinking is if you could keep a running count of all issues in a Project Entity Property, and then you could just use the "Issue Created" (note that this Rule is scoped to a single project) trigger and increment the "totalissues" property by 1 every time.

So that would look something like this:

Screen Shot 2021-09-27 at 9.22.33 PM.png

@Darryl Lee ,

Thanks for your help and tips on this and also what issues may crop up. The main intent was initially to send an email to me of all projects that contain at least 10 issues, but I can see where it can lead to problems. 

I can adjust it so that it would be a trigger that runs once a week to check what projects currently have at least 10 non-closed issues. An email will be sent that contains a list of these projects. If a project has at least 10 non-closed issues every week, then it will continue to appear in the email every week. 

The email is mainly used to determine which projects we have to allocate more resources to, because of the number of issues currently active.

It's a bit similar to what you stated in the first scenario except it will run once a week and the project is not hard-coded (e.g. not always "rdp").



Darryl Lee Community Leader Sep 28, 2021

AHHH, ok you're looking for projects that have at least 10 issues where Resolution = EMPTY

That makes a lot more sense, and yes, running this weekly would probably be good. Assuming folks are doing their jobs (or you aren't totally under-allocated on resources), you shouldn't hit the 100 issue limit. :-}

The thing is, I can't think of a way to do this without creating a separate rule for every Project.

That is, you can schedule a weekly task, but it will have to be with per project, so:

project = XYZ and Resolution = Empty

and another Rule with:

project = ABC and Resolution = Empty

Because I'm pretty sure you won't be able to extract different count totals for each project.

(There's no equivalent of GROUP BY in JQL.)

Darryl Lee Community Leader Sep 28, 2021

As @Bill Sheboy pointed out, there's no COUNT function, which would very helpful in your case, but I guess to put in SQL terms, you can only query ONE table with JQL, and that would be the "issues" table.

So that's why you'd have to have a different rule for each project. Because you'll always need to filter for issues in just that project.

Hi @Darryl Lee and @Bill Sheboy ,

thanks for your help on this. I was able to figure this one out. What I did is in the schedule trigger, under "more options", I checked the "Process all issues produced by this trigger in bulk".

This would allow me to use the Smart value issues.size. I would add a new condition (if / else block) which checks the value of issues.size and if it's bigger than 10, send the email out.



Darryl Lee Community Leader Oct 01, 2021

Glad to hear you got it working, @Jason Yeung ! Yes, I forgot about the "Process all issues" checkbox. Good that you found that.

So was I right in thinking you'll need one rule per Project? I couldn't think of any way around that.

@Darryl Lee ,

Yes, it would be per project. It may be OK, as some projects we have may no longer be active and it would allow us to customize the emails for each project.

I though it could be tedious to create each rule 1 by 1. But I think I can create it once, export it and then reimport and customize it for a different project.


Darryl Lee Community Leader Oct 01, 2021

Ah yes, the joy of creating (and maintaining) multiples rules.

From the global Automation Rules interface (under Administration -> System) you can Copy rules and change the project.

Screen Shot 2021-10-01 at 9.42.41 AM.png

Exporting can be useful if you're comfortable hacking around in JSON. For something like this, it would actually be pretty straightforward to do a search and replace on the projectId, and bulk generate several rules that could then be imported.

(I have a big hairy article about this that I have to fix up and publish some day.)

0 votes
Answer accepted

Hi @Jason Yeung 

First thing, JQL is not a SQL, and so it has no aggregate operations like COUNT.

With an automation rule, you can use the Lookup Issues action to gather the issues with your JQL, and then check count with the list size:


Please note: automation rules can only handle up to 100 issues at once, so if you have more than 100 the count will be incorrect.

Kind regards,

@Bill Sheboy ,

Currently I'm using Jira Server and I gather the lookup issue feature is only for Jira Cloud. Someone in the past asked about this ( and someone mentioned it's only for Cloud.

I was wondering if you know of an alternative to this action?



Hi Jason,

I missed that you were on server with my first post.  Sorry about that!  Please take a look at the alternatives that Darryl posted for some ideas on how to do this with your version.

I'd also direct your attention to where he asks: what problem are you trying to solve?  Knowing that context may help the community to offer additional suggestions.  Thanks!

Kind regards,

@Bill Sheboy ,

Thanks for your help. I tried setting a scheduled trigger, but then I tried to add an action, I couldn't find the Lookup Issues action. I get the following:


I tried doing something similar to She uses the lookup issues action as her second step, but I don't have this. I was wondering if there is another issue I could use? Or would I need a different version of the add-on? 


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events