I created an automation a while back that sends emails daily to the assignee of any issue that is overdue. This resulted in numerous individual emails for some users and I was asked to instead send out bulk emails.
Here is my basic workflow:
It almost works. The problem I run into is Automation doesn't filter the assignees for unique users. So if a user has five overdue issues, they will receive five identical emails with all of the issues listed.
I've searched and come up empty-handed trying to find a way to filter the list of assignees for unique ids. Any help is appreciated.
Screenshot below:
Hi @Brock Jolet
There appears to be a newer (?) feature for lists which allows pulling distinct values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#list.distinct
Given what is described and your use case, I expect you could use a Lookup Issues action to find issues meeting the criteria: has an assignee and is overdue. Then use this to populate a created variable: {{lookupIssues.assignee.distinct}}
And then split that created variable back into a list to drive the advanced branching, with one loop for each assign. The reason I suggest the created variable is so you can use lookup issues within the branch to create one email per assignee.
Kind regards,
Bill
Thanks, @Bill Sheboy .
This put me on the right path to accomplish my goal.
I originally was going to do more actions in the same rule, but opted for multiple rules. So I was able to remove the IF statement and removed my JQL search from the Cron.
I didn't need to store a custom variable, but I did use {{lookupIssues.assignee.distinct}} to feed the Advanced Branching. That was key.
I wonder if this is what @John Funk was hinting at in his post.
Here's a screenshot of the final rule:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, it was - sorry, just now able to get back to this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does anyone know if the list.distinct capability can be used in Advanced Branching in the Cloud version of Automation? I have a very similar use case, but when I try to do as described here, with a copy-pasted {{lookupIssues.assignee.distinct}}, I get the following error:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Peter
Assignee is an object in the smart values (with several attributes), so distinct may not work until you get to the level of a single attribute, like the accountId. Perhaps try {{lookupIssues.assignee.accountId.distinct}}
and then split the results so they can be used in the advanced branch.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, @Bill Sheboy - I gave that a try but came away with the same error. (Also tried {{lookupIssues.assignee.displayName.distinct}} with the same result.) I'm at a loss for how to parse the results into distinct assignees only
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Peter, I tried your original expression with Jira Cloud and it worked for me. The results in the advanced branch were to return the accountId automagically...as that appears to be the default attribute when used this way.
Please confirm your smart value capitalization as smart values are case-sensitive.
Note that my lookup issues JQL returned issues with and without assignees, and the use of distinct only returned assigned issues.
And of note: did you use a Variable name of "assignee" in the branch? If so, that would explain the error as that is a reserved name for the smart value. A tip is to always prefix your created variables and advanced branch variables with "var..." as shown below to make it unique.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, @Bill Sheboy - I think I found the root of my problem. In case this helps anyone else in the future...
@Brock Joletsaid "I originally was going to do more actions in the same rule, but opted for multiple rules. So I was able to remove the IF statement and removed my JQL search from the Cron."
I interpreted the way this was written to mean it was purely an optional decision (ie, "i opted to"), and that it could work even if you don't do that - but it can't. You must remove the JQL condition from the scheduled trigger, and the only way to do that is to remove any JQL conditions from the rule. So you HAVE to break this up into multiple rules in order for it to function as described here, so that you have no JQL in the scheduled trigger and no JQL conditions.
If you don't/can't remove the JQL from the scheduled trigger, that's when you wind up getting an email per issue rather than an email per assignee.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Brock Jolet, @Bill Sheboy,
This post is exactly what I was looking for for an answer, so thanks for that.
I only have 1 issue - My email is being sent out to me, and only me. It recognizes that there are different users, as per the log: but when I hit "run rule" to test it, it's only sending me the mail (examples of 2 emails from the same automation run):
I've tried setting the email recipient to assignee, and the smart value created, but I just get the same result each time. Any help would be much appreciated :)
My rule for comparison:
Thanks!
Jack
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jack,
I think Automation is not able to pull the email address of the {{currentAssignee}}. It needs to be explicit.
See my example of a working rule below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fixed!
Fantastic, thanks very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@[deleted] & @Brock Jolet
I have been staring at your conversation for the past 2 weeks. I've finally been able to make it work and get automated emails direct to my team.
I *heart* you guys soooo much.
@John Funk , I didn't need to bother you again!!!!
Cheers all, I've become drunk on happiness
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brock,
Take a look at this previous post. I would use the lookupIssues smart value function to do that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @John Funk ,
I read through that thread and don't think it addresses my issue. I'm already producing emails with a list of issues via the Lookup Issues component. The problem is that I'm getting multiple emails with the same information instead of just one.
I'm returning a list of issues from my IF statement, pulling out the list of assignees for those, and then using the Lookup Issues component to run a new query for populating the emails.
I'd like to figure out how to take the list of assignees and strip it down to only unique IDs before passing them into the Lookup Issues component.
Please correct me if I misunderstand how you would use the Lookup Issues component.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Brock Jolet
So sorry, I was out of the office around this time and missed any kind of email notification. Did you ever get this solved?
Also, it's good practice to always create a new question in the Community instead of adding to an already existing thread. That way more people will see it. :-)
In fact, if it's still a problem, I would suggest you create a new question. I and others should see it then.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Brock Jolet, I had similar problem, receiving multiple emails instead of one, solved by adding smart value {{lookupIssues.assignee.distinct}}
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.