Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting #lookupissue Results in Jira Automation

Amanda Crawford May 24, 2024

Hello,

I am using the #lookupIssues function in a Jira automation where Parent={{issue.key}} to return a list of child issues upon creation.  The following automation works great at grabbing those issues and hyperlinking them; however, the list creates the issue numbers in reverse chronological order. Is there a way to reorder these in chronological order.

Automation for Send email: (smart value used in email body)

{{#lookupIssues}}
<li><a href="{{url}}">{{key}}</a> - {{summary}}</li>{{/}}

Returns results:

XYZ - 9

XYZ -8

XYZ -7 ....etc.

 

I want: (based on associated child issues)

XYZ - 1

XYZ - 2...etc.

 

Thank you for your time,

 

Amanda

2 answers

1 accepted

2 votes
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.
May 24, 2024

Hi @Amanda Crawford -- Welcome to the Atlassian Community!

Please try adding the ORDER BY keywords to the JQL for your Lookup Issues action, selecting the order you want.  For example:

project = myProject ORDER BY Key ASC

When there is no ORDER BY on a JQL expression, I would hypothesize the returned issue order to be unknown (and subject to the implementation of JQL or randomness).

Kind regards,
Bill

Amanda Crawford May 24, 2024

That worked, thank you!!!

Like # people like this
0 votes
Kalyan Sattaluri
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.
May 24, 2024

Hello @Amanda Crawford 

In your lookupIssues JQL, just append ORDER BY Created ASC

Hope it helps. Thanks!

Amanda Crawford May 24, 2024

Hello,

Do you know how I would write that? Would I do it just as you have written it?

 

Thank you!

Kalyan Sattaluri
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.
May 24, 2024

yes, if your lookupIssues JQL is:

issuetype = Bug and status != Closed

Then just add order by clause to end like below:

issuetype = Bug and status != Closed  ORDER BY Created ASC

Amanda Crawford May 24, 2024

That worked, thank you!!!!

Like Kalyan Sattaluri likes this

Suggest an answer

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

Atlassian Community Events