Sort by ID rather than Name of a custom field in JQL(JIRA)

I have a custom-field "MONTH" with options: jan, feb,..,dec.

Now I want to sort by MONTH so that order will be jan,feb..... Is it possible?

3 answers

1 accepted

0 vote

Jira isn't clever enough to recognise abstracted names like that. I used to cheat by simply padding the names with empty space prefixes, but that's a bit horrid when you do it in JQL. For months, the only fixes I know of are:

  • Prefix month names with 01, 02, 03 etc
  • Write a field that understands that the options are months
  • Wedge in some javascript to do the sort (I avoid javascript as much as possible, and I'm not sure it'll help you here - I suspect you're looking at JQL, where javascript won't help you at all)

I doubt it, since it will sort the content of that field alphabetically.

I am not sure if this answer is covered by Nic's second case, but I have populated a second field with the sort order then using jql to sort by that column. The column does not need to be displayed to sort by it.

Norman,

I am not getting - Can you please elaborate in more details?

It's fourth valid way to do it - you create a new field called something like "sorted month", then use a plugin (script runner) to create a calculated field that populates it with 1 if your main field is Jan, 2 for Feb and so on.

Then your JQL could be something like "month in (Jan, Mar, Apr) order by sorted-month

(My third option was to write a field type plugin that gives you that works like any other select list, but has code that knows how to sort month names correctly. That is more coding than Norman's idea, but the JQL works more intuitively)

Thank you Nic for clarifying my terse description. Your description is exactly what I did and it took no more than 15 minutes to implement.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,277 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot