I want to create a Jira automation rule which sends out an email to each assignee based on a JQL query. The email should only contain a list with all issues assigned to the recipient.
Therefore, I created this automation:
And my email template looks like this:
{{#lookupIssues}}
{{if(equals(issue.assignee, issue.distinctAssignee))}}
<a href="https://jira-url/{{key}}">{{key}} {{summary}} </a> <i>[{{status.name}}]</i>
{{/}}
Problems:
Please let me know if you need any further information.
Help is much appreciated. Thank you!
Hi @Julian Petrich -
How are you creating your list of "distinctAssignees"? Because as far as I know that is not something you can get from a JQL lookup.
The other problem is that even if you had a way to create a list (manually using split()? API call?), the problem is you cannot reference a Smart value from inside of a list iterator.
In other words, {{distinctAssignee}} cannot be accessed from within the {{#lookupIssues}} iterator.
I think the approach you'll want to take is detailed here:
So you would put your Lookup inside of your Smart value branch, and modify your JQL to be:
project = 11844 AND type="finding" AND resolution is empty AND assignee={{distinctAssignee}}
Then all of the {{#lookupIssues}} should be the ones you want for each assignee, and you don't need to use if to filter them at all.
Hi @Darryl Lee
Thank you for your help! That makes sense.
This is how I am getting my distinct assignees but maybe that's not even the best way to do it:
I have tried your suggestion with another JQL query inside my Smart value branch which worked for a small amount of assignees. Once I changed the scope to all the assignees I got this error message:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OH SHOOT, there is a distinct. Nice!
Huh. That is a weird error. When you say you had a small amount of assignees, do you mean you scoped the first Lookup to only include certain assignees?
I guess first off, how many issues are we talking about in the original query?
And how many distinct assignees are there?
(You could log {{lookupIssues.assignee.distinct.size}} to find out.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, so in the initial lookup I had only myself and a colleague as assignees to test it the rule which worked perfectly.
The query has 142 issues and 24 distinct assignees.
The main reason to have this rule is that we close and open issues going into this query. Hence, I don't want to update and send emails manually.
My current workaround is to include a filter into my email with the query above and "assignee=currentUser()".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bizarre. The custom smart variable the first time around is 24 assignees.
So you started getting the error when you added another Lookup for:
project = 11844 AND type="finding" AND resolution is empty AND assignee={{distinctAssignee}}
So like, 24 times, it should run that query and each time it should return a set of issues that is easily < 142, so... I don't know.
Maybe this is a question for Support?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, correct. So my second lookup was within the new branch. I was surprised as well.
Sure, I will reach out to the support then.
Thanks a lot for your support @Darryl Lee it's good to know that it should work at least.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.