hey all,
I'd like to be able to create a Daily automation that checks the results of a JQL and sends an email to persons matching a Conditional criteria. Some details:
I can't quite get the Conditional part right. Here's a picture of what I have so far:
Hello @Mike Fink
Welcome to the Atlassian community!
How is the rule not working for you? What does the Audit Log for the rule show?
Simply put, I know there are 13 issues for the individual in the query so I know I should be getting an email if I set it up correctly. I got an email when I had some syntax errors and it straight up failed, but I don't get an email when it's "successful".
Hope that makes sense.
Side question - where do I see the audit log?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you have in your Trigger? Is it just a time/schedule, or does it also include a JQL statement?
Are you explicitly naming a single Assignee in the JQL statement?
Where did you get information about the "count of" syntax you use in your comparison? I've not yet been able to find information on that.
The link to the Audit Log is above the components (shown in your image).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The way I would probably build this rule (unless I'm missing some requirement) would be:
Trigger: Schedule (with no JQL)
Action: Lookup Issues (put the JQL here to get the list of issues for a specific Assignee)
Advanced compare:
{{lookupIssues.size}} gives you the number of issues returned by the Lookup Issue action. Compare that to the threshold value
Action: Send email
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Trigger/Schedule has a JQL in it. It won't let me save it without it, for some reason.
Trigger: Schedule (2PM daily)
Action: Looks for list of Bugs by Assignee
Advanced Compare: if the count of issues returned is greater than 9, on to Action
Action: Send email
I figured out that I had to de-select "Only include issues that have changed since the last time this rule executed" on the When: Scheduled step (Trigger). It sends emails now, but it shoots me an email for every issue (13 total). That's kinda sub-optimal.
I also tried the {{lookupissues.size}} approach but it wasn't successful for some reason :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you use a Schedule trigger with a JQL the actions in the rule will be executed for each issue returned by the JQL.
You should be able to save the Schedule trigger without a JQL if you uncheck the "Run a JQL" box.
I can help you debug the Lookup Issue problem, but you would need to show me the rule after you modified it for that. Also note that smart value needs to have a capital "I" for "Issues" - {{lookupIssues.size}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get the following when I de-select "Run a JQL search" etc:
I also tried again with the {{lookupIssues.size}} and it didn't return anything. The JQL I'm using is as follows:
project = DB AND issuetype = Bug AND createdDate > "2019/12/01" AND (priority in (High, "Needs Triage", Normal, "Unbreak Now!") OR updatedDate > "2021/9/19") AND status != "Bug Deferred" AND statusCategory != done AND assignee = "username" ORDER BY priority DESC, updated DESC
Username is specified in the query though. I'm guessing my problem is either in the JQL or in the structure in general...
Really appreciate your help @Trudy Claspill!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You would need to get rid of the "If issue matches JQL" component before you can save the Schedule Trigger with the JQL option unchecked.
Or you can start from scratch with a brand new rule.
Can you try constructing the rule this way and let me know what the results are?
Also, please let me know what you have set for the Rule Actor. That's on the Rule Details page.
Trigger: Schedule (without JQL)
Action: Lookup Issues
Advanced Compare:
{{lookupIssues.size}} greater than 9
Action: Send Email
Please show me the entire rule and the output of its execution in the Audit Log.
Also please take the JQL that you put in the Lookup Issues action and try it in the Advanced Issue Search screen to confirm that it is getting the issues you expect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That worked! I appreciate your help so much, @Trudy Claspill
I have one more question, which hopefully isn't too hard.
Now that the automation works for one person, is there a way to expand it to an entire team in a project and have it send out emails to each team member matching that criteria?
I assume it would be something like:
Action: Lookup Issues and remove "AND assignee =" section of JQL
Advanced Compare: (same)
Action: Send Email to "Assignee"
Does that seem right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't believe that would be correct. Your comparison would be counting all the issues returned by the Lookup, which would be the total count for all Assignees.
And as written I don't think it would not send an email to each Assignee.
I'll have to think on this one a bit and get back to you. Off the top of my head I don't know how to recurse through a Lookup issue data set and get counts of subsets of issues based on the Assignee.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For anybody that stumbles across this, the topic of automating notification for multiple assignees that have X number of issues assigned was started fresh in this post:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey @Trudy
Slight problem - the email triggers regardless of the number of issues it finds. I ran it against a query that only returns 3 results, and it sent the email all the same. I think something is wrong with the Compare Two Values section:
Any thoughts? I have had to deactivate the automation :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The value you are comparing {{lookupIssues.size}} to should not be in curly braces.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks - played around with that after posting and can confirm that works now. Thanks @Trudy Claspill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update: I'm looking to do this via Jira python API now so it is more robust and executes programmatically. Makes it easier to update the query that way too.
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.