How to Loop Through Multiple Jira Issues for a Project Automation Rule Message?

Brooke Miller June 5, 2019

I'm trying to create an automation rule that gets triggered at the end of every sprint (every 14 days) and searches for epics that have transitioned to the "Done" or "Blocked" status in that time period. Then, I want the action to send a message to a Microsoft Teams room that encompasses the list of those epics that have transitioned in that sprint.

In the chat message, I'd like to loop through the issues returned from this JQL Query so for each issue, the following message would be generated as a single line item in one chat message:

"[{{issue.key}} {{issue.summary}}]({{issue.toUrl}}) was transitioned to {{issue.status.name}}."

Currently, the above line item is only generated for the first issue, so I need to find a way to loop through these issues so that this message gets returned for each issue. Can anyone help?

Example Message.PNG

Below are my rule details:

Trigger step:

Rule Details - Trigger.PNG

 

Action step:

Rule Details.PNG

2 answers

1 accepted

1 vote
Answer accepted
Brooke Miller June 5, 2019

Figured it out. Need to use the following to have the issues loop. Also, using the <a> tag with href attribute does the trick to get the link to work. 


<ol>
{{#issues}}
<li> <a href="{{toUrl}}">{{key}} - {{summary}}</a> was transitioned to <b>{{status.name}}</b>. </li>
{{/}}
</ol>
0 votes
Brooke Miller June 5, 2019

Hey @andreas, are you able to help me out here? Saw your replies to previous questions somewhat similar to this. Thought maybe you'd be familiar with how to solve this issue.

Brooke Miller June 5, 2019

Please disregard the above. I saw your comment to a previous post and applied that logic. However, it doesn't seem like you can use links in an HTML list (bullet list or numbered). Please see my code below and the result set. Is it possible to create links in some other way in a list?

{{#issues}}
[{{key}} {{summary}}]({{toUrl}}) was transitioned to {{status.name}}. <br />
{{/}}

<ol>
{{#issues}}
<li> [{{key}} {{summary}}]({{toUrl}}) was transitioned to {{status.name}}</li>
{{/}}
</ol>

This produces the below:

Both.PNG

Simon Brooke June 6, 2019

Hi @Brooke Miller ,

I actually build the hyperlinks myself... Tested and it works in an ordered list:

<ol>
{{#issues}}<li><a href="https://jira.abcdef.com/browse/{{key}}">{{key}}: {{summary}}</a> ({{assignee}})</li>{{/}}
</ol>

 

Regards,

Simon

Carl Davis November 13, 2020

@Brooke Miller 

Very interesting.  How did you acquire the initial issue list by limiting the project, sprint, etc.

 

Thanks,

Carl Davis

Suggest an answer

Log in or Sign up to answer