Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

1 Notification per assignee via Automation on Jira

Nicolas Zuderell March 21, 2022

If I make a JQL query "Sprint in openSprints() and statusCategory != Done" and there are for example 10 Issues found. -> Now I split the query again so that I only have the tickets with the assignee XYZ, let's say 5 of 10 issues are assigned to XYZ. -> Assignee XYZ should now be notified that these 5 tickets are still open via MS Teams or mail.

Now my problem:
{{#lookupIssues}}
* {{url}}
{{/}}
With this smartvalue I get a list of all issues in the above query, BUT assignee XYZ now gets 5 messages with the same content.

Can this be reduced so that he is notified only once?

1 answer

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.
March 21, 2022

Hi @Nicolas Zuderell -- Welcome to the Atlassian Community!

For a question like this, please post images of your complete automation rule and of the audit log details showing the run of the rule which does not work as expected.  That will provide context for the community to offer suggestions.  Thanks!

Until we see that information, I suspect your rule has a scheduled trigger on JQL, leading it to run for each issue in the trigger set.  The solution may be to remove the JQL from the trigger and just run on a scheduled...using the JQL exclusively for your lookup issues action.  Then only one email will be sent.

Kind regards,
Bill

Nicolas Zuderell March 21, 2022

Thanks Bill to your answer it helped me with my MS Teams notification.
On the Mail i will get this message:

2022-03-21_Audit_log-Jira.png

 

This is my rule:

2022-03-21_rule-settings-Jira.png

Do I need a step more or do I something wrong?

Best Regards
Nicolas

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.
March 21, 2022

Once you removed the JQL from the scheduled trigger, the Send Email now needed another source for that issue information: Lookup Issues.

Please try using {{lookupIssues.size}}

Nicolas Zuderell March 21, 2022

I have removed all JQL from the trigger and i still get the error from above in the audit log.
I deleted the JQL before i unchecked the box:2022-03-22_triggered_scheduler.png

 

also i removed the smart value in the subject of the mail. the content is still to the assignee of the ticket:
{{#lookupIssues}}
* {{url}}
{{/}}

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.
March 22, 2022

Would you please post images of:

  • the details of your send email action
  • the details of the audit log showing the error after you made the changes to the rule

That may indicate what is happening.

 

The other possibility with Jira Cloud automation rules is they sometimes get "glitched" by changing the components to many times.  The way to test that is to disable this rule and re-create it as a new rule and see if that works.

Nicolas Zuderell March 22, 2022

Email action:

2022-03-23_sendMail-settings.png

 

And here the log between the changes:

2022-03-23_auditlog.png

 

i have recreated the rule with the same actions and triggers it dont works neither.

 

if i put my own mail adress in the "to-section" it works. If i put the assignee (like the first screenshot in this comment) it brings the "some errors" warning

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.
March 23, 2022

Ah...got it.  Assignee in that context for the to-email-address is undefined, as there is no issue.  They are all in the Lookup Issues result.

The way to solve this is to get the email address from the lookup, and add a safety check  condition with this:

  • trigger: scheduled...
  • action: lookup issues...
  • advanced compare condition...
    • first value: {{lookupIssues.size|0}}
    • condition: greater than
    • second value: 0
  • action: send email with the to-email-address of {{lookupIssues.first.assignee.emailAddress}}

For the email address, type/pasted that smart value into the field and it will appear below it, then you can select it.

Like Nicolas Zuderell likes this
Nicolas Zuderell March 23, 2022

Thank you!

Like Bill Sheboy likes this
vdhanorkar July 28, 2022

@Bill Sheboy Thanks for the steps, i tried the same but in my case one assignee received a mail but another did not. could you please suggest? please see attached screenshot

Image-1.png

Email:

Image-2.png

Also i don't want to send other assignee's tasks details in mail body, both assignee should receive only their own task details in mail body.

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.
July 28, 2022

Hi @vdhanorkar 

Your use case is different as there could potentially be multiple different assignees.  As a result you need a different rule, as what you posted references only the first assignee from the lookup issues result.

One possible way to do that is:

  • trigger: scheduled
  • action: lookup issues with JQL
  • condition: check if there were any results before proceeding
  • advanced branch on smart values: on the distinct assignees found, using the lookup issues as a source from {{lookupIssues.assignee.accountId.distinct}} and a loop variable named varAccountId
    • action: lookup issues with the same original JQL, plus the clause assignee = {{varAccountId}
    • action: send your email

Kind regards,
Bill

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 28, 2022

Ohai Bill!

So as I laid out in my answer to @vdhanorkar's standalone question over here, I actually branched on {{lookupIssues.assignee.distinct}} in the "For each" so that I could access {{thisassignee.accountId}} for the nested JQL lookup and also use {{thisassignee.emailAddress}} for the To: in the email.

Like Bill Sheboy likes this
vdhanorkar July 29, 2022

@Bill Sheboy Thanks, The solution you suggested working to me

Zaldy Parian
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.
February 28, 2023

Hi @vdhanorkar ,

Would you mind posting screenshots of your automation here? I'm also looking to send 1 email to all assignees. The body of an email includes all issues returned by a JQL filter. The list of issues is formatted in a table.

I got it all working, except for all assignees. As you can see in the snippet below, I included both {{lookupIssues.assignee.displayName}} and {{lookupIssues.assignee}}. But the actual email sent every Tuesday morning did not include any of the assignee.

automation1.png

Thanks for your help.

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.
February 28, 2023

Hi @Zaldy Parian 

Just to confirm...your scheduled trigger does NOT have JQL, correct?

If so, it appears you want to send that email to all possible assignees for the issues in the lookup issues result.  To do that, please update the email TO with the below expression.

{{#lookupIssues}}{{assignee.emailAddress}};{{/}}

That will iterate over the lookup results and add each assignee's email address, followed by a delimiter.  

If that sends duplicates to the same assignee, you can adjust that using distinct like this:

{{#lookupIssues.assignee.emailAddress.distinct}}{{.}};{{/}}

 

Kind regards,
Bill

Zaldy Parian
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.
February 28, 2023

Hi @Bill Sheboy ,

Appreciate your quick response.

The Then: Lookup issues has filter as shown below.

automation2.png

I added in the To: field of the email your suggestion of 

{{#lookupIssues}}{{assignee.emailAddress}};{{/}}

but still no luck. Only the emails from the customfield_10174 are receiving the email. 

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.
March 1, 2023

Would you please write that smart value expression to the audit log, and then post an image of what it includes after the rule runs?

Zaldy Parian
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.
March 1, 2023

Hi @Bill Sheboy ,

Apologies for my ignorance; but how do I write the smart value to the audit log? Last time i executed the automation, it was successful, but the recepients supposed to be included in {{#lookupIssues}}{{assignee.emailAddress}};{{/}} did not receive an email. Only those in {{lookupIssues.customefield_10174}} got an email.

Here's a grab of the audit log. Though the issues were included in the successful associated items, the email did not include the email address of assignee.

automation3.png

Can you please elaborate on audit log?

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.
March 2, 2023

There is a rule action named Log which allows writing text or smart values to the audit log.  Please add that action to your rule after the lookup issues action, including this:

Here are the expected assignees: {{#lookupIssues.assignee.emailAddress.distinct}}{{.}};{{/}}

 

Like Zaldy Parian likes this
Zaldy Parian
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.
March 2, 2023

Hi @Bill Sheboy 

I think you suggestion is working. The Log action display distinct emails of all Assignees.
I'll put the same smart value in the To: field of the email and see how it goes next week in its next scheduled run.

automation4.png

Thanks very much for your patience and kind support.

 

Cheers,

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events