JQL Query for extracting all backlogs related to a project

Pranay Verma
Contributor
August 23, 2019

I wanted to extract all backlogs related to a particular project. I read one of the queries related to this and came up with something like this :

project = *project_name* AND issuetype in (Task, Bug, Improvement, "New Feature", Enhancement) AND sprint is EMPTY AND resolution = Unresolved and status != Closed

But this doesn't seem to be working. 

Can someone help me out with how all backlogs can be extracted? 

3 answers

1 accepted

3 votes
Answer accepted
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2019

Hi @Pranay Verma,

If I got you correctly, you may not get the exact count shows in the backlog as your result

it's because any tickets moved from sprint to backlog during sprint closing then the sprint field is not empty on those tickets.

I hope below query may help you to fetch your backlog tickets

project = *project_name* AND issuetype in (Task, Bug, Improvement, "New Feature", Enhancement) AND (sprint is EMPTY OR Sprint not in (openSprints(), futureSprints())) AND resolution = Unresolved and status != Closed 

 

Regards,

Leo 

Pranay Verma
Contributor
August 26, 2019

Hi @Leo This query is partially working for me. Thanks a lot!!!! The only thing is I'm trying to do this using Python. 

I've tried something like this:

issues_in_backlog = jira.search_issues('project = \"AM+ Assets Delivery\"' AND issuetype in (Task, Bug) AND (Sprint is EMPTY OR Sprint not in (openSprints(), futureSprints())) AND resolution = Unresolved AND status != Closed)

But this is giving a syntax error, that I tried in both the code as well as the Advanced Search textbox. Could you help me with the syntax? Then I could probably filter my query, that'll provide me with all the relevant backlogs. 

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 26, 2019

Hi @Pranay Verma,

I don't find any issue with query and I'm not familiar with python. if you could attach the screen shot of advance search error. I may get something to suggest

Pranay Verma
Contributor
August 27, 2019

Hi @Leo ,

Earlier, I'd run this query for getting all the issues in the project, and this worked perfectly for me. I'm pasting the query so you could use it for your reference.

issues_in_project = jira.search_issues('project = \"One+ Dev Proj\"', startAt=0, maxResults=1000,validate_query=True,fields=None,expand=None,json_result=None)

So, the only difference that should happen here will be in the JQL, since it'll be refined only for getting the backlogs.

I've attached the Advanced Search box screenshot, where I'm getting the Syntax Error, for the Backlog Query. 

Could you please have a look at this query, and point out where I'm going wrong.

Thanks,

Pranay

JQL_Python.PNG

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 27, 2019

Hi @Pranay Verma,

I don't think the way you put your query in advance search will work, as you are invoking python code there, I'll attach both screen shots from my window where python code will throw error and only the JQL query will succeed. 

query success.pngquery with python.png

Like Pranay Verma likes this
Pranay Verma
Contributor
August 27, 2019

Hi @Leo ,

Yes I'm aware that the below one won't succeed in this window. I was successfully able to run the JQL in the advanced search box. I just wanted to point out the previous python code and the new one, so that you could compare and point out to a potential syntax error, since as I earlier mentioned the only difference in the jira.search_issues() method would be only in the JQL. 

Could you help me with the syntax if possible?

Thanks,

Pranay

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 27, 2019

Hi @Pranay Verma,

I'm not familiar with python code but below syntax may work for you, if my assumption is right from Project till status should be covered with single quotes(''). and the others are parameters like startAt,etc.. so no need to be covered by quotes

 

issues_in_backlog = jira.search_issues('project = \"AM+ Assets Delivery\" AND issuetype in (Task, Bug) AND (Sprint is EMPTY OR Sprint not in (openSprints(), futureSprints())) AND resolution = Unresolved AND status != Closed', startAt=0, maxResults=1000,validate_query=True,fields=None,expand=None,json_result=None) 

 

Regards,

Leo

Like Pranay Verma likes this
Pranay Verma
Contributor
August 27, 2019

Hi @Leo ,

You're a lifesaver!!!!!This did the trick!!!! Thanks for the help !!!!!!

Thanks And Regards,

Pranay

Shailen Mistry February 10, 2020

From the answer above, it had some errors for jira online.  

project = *project_name* AND issuetype in (Task, Bug, Improvement, "New Feature", Enhancement) AND (sprint is EMPTY OR Sprint not in (openSprints(), futureSprints())) AND resolution = Unresolved and status != Closed

The JQL below worked to show the tickets in the backlog.

project = *project_name* AND issuetype in (Task, Bug, Story) AND (sprint is EMPTY OR Sprint not in (openSprints(), futureSprints())) AND resolution = Unresolved and status != Done ORDER BY rank
0 votes
Muhammad Ramzan(Atlassian Certified Master)
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.
August 25, 2019

If you want to show all backlog items then please only use the following query it will show all backlog items.

 

project = *project_name*
Pranay Verma
Contributor
August 25, 2019

Hi @Muhammad Ramzan(Atlassian Certified Master) 

I'm afraid this along with the backlogs will also give the ones which aren't in backlogs.

0 votes
Sreenivasaraju P
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.
August 23, 2019

Hi @Pranay Verma ,

What do you mean by not working. It is not returning all the tickets or returning more ticket.  can you give more details..

Bill Sheboy
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.
August 23, 2019

Yes, and...

Hi @Pranay Verma 

What is the problem you are trying to solve with this query?  Knowing that will help the community better answer your question.

Thanks, and best regards,

Bill

Pranay Verma
Contributor
August 25, 2019

Hi @Bill Sheboy So basically, I wanted to retrieve all the backlogs that are present in a particular project, be it a part of a sprint or not, just all the backlogs. You can just ignore the query that I'd created, and help me with a fresh query.

Thanks,

Pranay

Bill Sheboy
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.
August 27, 2019

Hi @Pranay Verma 

Thank your for clarifying your goal.

How about this idea: make a simple Kanban board, with columns showing any of the relevant status values for Todo (e.g. backlog), In progress, and Done.  Then make a filter including the projects, status values, etc. that you are interested in.

 

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer