Jira automation: Send a user a single email list of issues, then add a comment on each

Joshua Smith December 13, 2024

Hello,

TLDR: Lookup Issues action used to send a single email list to a user for all their assigned issues using a "distinct" smart value essentially breaks when "Run a JQL search" is enabled on the Scheduled trigger, which is done to enable an additional action (Add a comment to the issue).

Details:

I'm attempting to create a Jira automation which does 2 things:

1. sends a single email to the assignee of all issues returned by the jql query, for all issues they are assigned to.

For example, if I have 5 issues and 2 are assigned to user A and the other 3 to user B, then User A will get an email with their 2 issues, and user B will get one email with their 3 issues.

This approach (use a Lookup issues action, which runs a jql query) as documented by Atlassian works perfectly for that. However...

2. Add a comment to every Jira issue that was returned by the same jql query, in the same automation as above.

I thought this would be as simple as adding a "add comment" action, but when I try that, I get this error:
Snag_795f0b70.png

The only remedy I've found for this error, is to go back to the automation trigger (a Scheduled trigger), and enable "Run a JQL search and execute actions for each issue in the query":
Snag_7961a3fd.png

Now, this works just fine - it does add the comment to the issues returned... but it breaks #1 above and instead of User A and User B each getting a single issue with their respective lists of issues assigned, they each now get one email for every issue. So each of these actions work perfectly on their own, but do not work properly when part of the same automation.

Any suggestions? Thank you very much in advance!

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2024

Hi @Joshua Smith 

Following that how-to article helps to send one-email-per-assignee with their respective issues: https://confluence.atlassian.com/jirakb/automation-to-send-email-only-once-per-assignee-1310985609.html

Please note that the rule uses the advanced branch over Assignees and not issues.  As a result, the Comment on Issue action has no issues on which to act.  That is what the generic error means: the action / condition needs an issue and one is not present at that point in the rule.

 

If you want to add comments to the issues, the rule would need to separately branch on issues.  (But not add JQL to the scheduled trigger, as that would create other problems for this type of rule.)

Before you add that, what is the purpose of the comment you adding?  To which issues does it apply?

 

Kind regards,
Bill

Joshua Smith December 16, 2024

"Please note that the rule uses the advanced branch over Assignees and not issues. "

Thank you for this, I do not know much about advanced branching or how it works, so this was very helpful!

"Before you add that, what is the purpose of the comment you adding?  To which issues does it apply?"

The requirement is essentially, "email the assignee and then add proof to the record that the assignee was emailed." So, the comment should apply to the same set of issues, using the same JQL query, as the issues on which the assignees were emailed.

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 16, 2024

You described the "what" you are trying to do, and not "why do this".  Such as, "why is proof needed a reminder email was sent?"

In my experience, sending scheduled reminder emails is a "smell" there is a root cause, process problem.  Perhaps meet with the team to use a 5-whys or other RCA method to learn that root cause and how to address it.

Like Joshua Smith likes this
Joshua Smith December 16, 2024

After considering your comment, I added a separate branch for adding the comment to each issue and it worked without problem, thank you!

0 votes
Prosper Agwegiokhe December 14, 2024

Hi @Joshua Smith

Welcome to the Atlassian Community!

My name is Prosper, and I’m a Support Engineer at Appfire. I’m here to help.

If you’re open to a plugin suggestion, I recommend trying our app, JIRA Misc Workflow Extensions for JIRA Cloud. You can create a scheduled action to achieve the result you are looking for in one automation:

  1. Specify when the automation should be executed.
  2. Use a JQL filter in the "If" scope by passing the filter in the JQL Expression.
  3. Choose to run the automation as an Add-on User, a specific user, or any of the options available in the dropdown.
  4. Add post functions; in this case, sending an email and commenting on issues where the email was sent.

Please refer to the attached screenshot for more details.

Screenshot 2024-12-14 235514.png

You can also find more information in our documentation. If you have further questions or need assistance, feel free to open a support ticket. We’d be happy to help!

Best regards,
Prosper

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events