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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

ORDER BY with experessions or functions

I want to put tickets with some selected status at the end. A am looking for some sort of expressions inside ORDER BY:

assignee = currentUser() AND status != Erledigt ORDER BY (status == Zurückgestellt)

SQL would evaluate last expression to "1" of "0" and use it for ordering.

JIRA doesn't accept it:

Error in the JQL Query: Expecting a field name but got '('. You must surround '(' in quotation marks to use it as a field name. (line 1, character 90)

2 answers

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 28, 2023

As @Alexandre Pezzini explained, you can't do this out of the box.

But you can:

  1. You can create a Number type custom field "Weight". Number is a great choice, because ordering is untuitive.
  2. Using an automation rule (or a script), set this field's value to 0 if status == "Zurückgestellt" and 1 otherwise every time when the status changes. (You can complicate the logic and use more than just two different weight values.)
  3. In CQL use this: "order by Weight".

Should be straight-forward.

0 votes
Alexandre Pezzini
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 27, 2023

Hi @Rodion Alukhanov ,

Welcome to the Atlassian Community!

The issue is that you can't use a condition or a function at the ORDER BY . It would be possible if JQL accepts like CASE WHEN in ORDER BY, but that isn't allowed.

To reach what you want, would be best if you use a REST API, then you can use a JQL to limit the statuses, and once you gather the issues you can order in your code as you wish.

But feel free to raise a Feature Request if you wish this feature to be implemented.

Just be aware that there are a number of factors that determine how Atlassian prioritizes suggestions. You can learn more about this by reading our Implementation of New Features Policy.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events