I would like to order results from JQL by Story, Bug then Task

Deleted user April 4, 2018

Good Morning/Afternoon,

I would like to be able to order the results from Jira using JQL, we would like to be able to return the results ordered by Story, Bug then Task. We would like each type to be ordered descending so that the newest data is returned first.

I am not sure if it is possible, please see the below example of what I am looking to achieve:


MSM-100 (Story)
MSM-50 (Story)
MSM-10 (Story)

MSM-200 (Bug)
MSM-52 (Bug)
MSM-19 (Bug)

MSM-300 (Task)
MSM-60 (Task)
MSM-24 (Task)

Here is the JQL query we are currently using:

/rest/api/2/search?jql=fixVersion = 1.0 AND type != "Pre-release bug" AND type != "Defect" AND "Hide From Portal?" is EMPTY ORDER BY type, key DESC

We are hiding some of the items as we only want to show stories, bugs and tasks.

Is this possible to do with JQL or some kind of filter?

 

3 answers

1 vote
Warren
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.
April 4, 2018

Hi Dean

Looking at the details of your question, it seems as if you're using the REST API, which would hint at you using some programming language to manipulate the returned results. If so, you can quite easily do what you're after in code.

The JQL you've given as part of the API call will give you most of what you want anyway, except that you have no control over the order of "types"

1 vote
arama mihai
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.
April 4, 2018

Hi,

I don't know of any non customized way of doing this.

We had a similar request, and solved it by creating a new custom field with the "Misc custom fields" (free app - https://marketplace.atlassian.com/plugins/com.innovalog.jmcf.jira-misc-custom-fields/server/overview)

The field is "calculated number" type; I named it "Hierarchy".

The formula for it is:

<!-- @@Formula: String issueType = issue.get("issuetype").getName().toString(); if (issueType.equals("Story")) { return 1; } else if (issueType.equals("Bug")){ return 2; }  else if (issueType.equals("Task")){ return 3; } -->

Once the formula is applied, you will see the values, but you will actually be able to order properly by it only after a reindex.

Hope this helps!

0 votes
Deleted user April 4, 2018

Thank you both for your responses.

Arama, thank you for the information, I will look into the plugin and see if we can implement this as a solution.

Warren, I thought that might be the case, I didn't think it was going to be that easy. The reason I would prefer it to be completed in Jira is because we are using an IntersectionObserver to pull through 15 records at a time.

I will have to have a think about how I can implement this into the application, it is not too far off. It currently does Task, Story, Bug. I was hoping there was something which I had missed which would make this easier.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events