JQL filter sort by a field and when empty by another

Walter Lamm January 30, 2023

Hey there,

I want to configure a board filter that uses two date fields and right now I have this sorting method:

"ORDER BY due ASC, cf[10135] ASC" which of course returns the attached list "WRONG".

Sorting.jpg

This method sorts all issues by due date and when sharing a due date with another issue by cf[10135]. This way all issues with an empty due date are sorted behind the other issues with a due date.

But what I actually want is a sorting by due date and when empty by cf[10135] so it looks like the attached list "RIGHT".

Sorting2.jpg

How should my JQL query look like to achieve this?

Thanks a lot!

1 answer

1 accepted

3 votes
Answer accepted
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 30, 2023

Hi @Walter Lamm,

I am afraid you are trying to do something that is not possible in JQL You cannot do conditional sorting.

As a workaround, you could consider adding either a calculated field. That is unfortunately not available out of the box in cloud an would require looking into marketplace apps (see feature request JRACLOUD-61966 - also for available workarounds). 

You could also add an additional custom field and use automation for Jira to store a single value from either field, that you can then use just for sorting your list the way you want.

It all depends how important this requirement is to decide if it is worth the effort.

Hope this helps! 

Walter Lamm January 31, 2023

Hey @Walter Buggenhout

thanks for the quick reply!

That's a bummer but the workaround isn't really worth the effort because what we have are temporary transitioning pains that'll hopefully clear up in the upcoming weeks. 

Have a great day!

Like Walter Buggenhout likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events