How to organize a list of {{#issues}} by {{status.name}}?

e_erwin_offensive-security_com June 4, 2021

Product: JIRA Server and JIRA Automation

I've been at this for a while and have gotten close but just not where I want to be and starting to question if it's even possible or not. 

My automation rule has a scope of 3 projects and triggers with a scheduled JQL (validates successfully) followed by a Send email action.

Generally this will result in a list of 10-20 issues.  I would like to organize the list in according to issue status {{issue.status.name}} and {{issue.project.name}} but so far have not found a way to do this in a single email action step.

I have a couple of work arounds for this, one of which involves 5 For JQL branches that each Then: Send an email action.  This alone seems like overkill even before the post JIRA merging of said emails to produce the desired result.

At any rate here is what one of the 5 branches look like

When Sceduled:

|

For JQL:

(project = ITHD AND status in (Backlog))

       Then Send Email:

<i><b>{{issue.status.name}}</b></i></br>
{{#issues}}
<a href="{{toUrl}}">{{summary}}</a></br>
{{/}}
</br>

The resulting email looks something like:

 

Backlog
Example issue summary 1

Example issue summary 2

 

To do it in a single JQL + send email step... 

When Schedule:   

 

(project = ITHD AND status in ("In Progress", Backlog, Blocked)) OR (project = "HR-Employee Onboarding"  AND status in (Backlog)) OR (project = "HR-Employee Offboarding" AND status in (Backlog))

 (Single JQL occurs in the schedule trigger step)

How could I format a single Send Email action to produce something like this:

 

Task Handoff:

Backlog
Example issue summary 1

Example issue summary 2

 

In Progress
Example issue summary 1

Example issue summary 2

 

Blocked
Example issue summary 1

Example issue summary 2

 

Onboarding
Example issue summary 1

Example issue summary 2

 

Offboarding
Example issue summary 1

Example issue summary 2

 

I would very much appreciate some insight into what I'm probably missing something (that's surely looking me in the face).  Thanks in advance to anyone willing to offer some guidance.  Thank you!

1 answer

1 vote
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.
June 4, 2021

Hi @e_erwin_offensive-security_com  -- Welcome to the Atlassian Community!

First a disclaimer: I am using the Cloud and not Server version... and Cloud and Server have different methods for batch processing a set of issues (LookupIssues and Scheduled JQL Batch, respectively).  So...

Have you considered trying the conditional logic functions inside of your email body:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-conditional-logic/

Perhaps using {{#if.. clauses inside of {{#issue}} iterators.  You could try to repeat that structure, having sections for each status.  I cannot tell if this works for Server, so please let me know if it works.  You would need to hard-code the section titles, I think.  For example...

<i><b>Backlog</b></i></br>
{{#issues}}
{{#if(equals(status, "Backlog"))}}<a href="{{toUrl}}">{{summary}}</a></br>{{/}}
{{/}}
</br>

<i><b>In Progress</b></i></br>
{{#issues}}
{{#if(equals(status, "In Progress"))}}<a href="{{toUrl}}">{{summary}}</a></br>{{/}}
{{/}}
</br>

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer