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 votes
Accepted answer

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.


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 Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,124 views 4 9
Read article

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