Jira Rest JQL - How to grab all closed sprints pertaining to a project

Hello Community,

I am trying to write a JQL that grabs all the closed sprints pertaining to a certain project. 

I have the following JQL I am running in a Search Rest API:

'project' = 'Project-1' and sprints in closedSprints()

This returns me issues within the project that have the closedSprints() in them. From there I just JSON myself into the issue and grab the sprint that is attached to it.

For somereason, this JQL is only returning the most recent closed Sprint for the project. I would like to receive ALL of the closed sprints a project has ever had.

Would anyone know a solution to this.

I appreciate your time and expertise.


1 answer

1 accepted

1 vote
Accepted answer

To the best of my knowledge the closedsprints() function in JQL is not limited to just returning recent sprints.  There is no mention of this in the documentation for this function either.  This function can return any issue if it exists in that closed sprint in this JIRA instance.   But the other aspect here is that JQL doesn't return sprint names directly. 

Instead JQL is return issues that meet that criteria.   So the way JIRA is doing this is by looking at the Sprint field on these issues.  An issue can exist in multiple sprints, so it can have multiple values for that field.  If any of the values in that field are closed sprints, then this issue itself should be returned by your query.

There are cases though I have seen where admins might want to remove old sprint field values from some issues.  This tends to happen if these issues need to be moved into a separate project and you don't want that sprint to also appear on the new board/project where this issue is moving.   If that happens, and someone edited the fields of these issues to remove values from the sprint field, that would prevent you from seeing such issues in the closesprint() function.   Alternatively if issues have been moved to other projects altogether (even without changing the sprint field), in turn they would not meet the project criteria of your JQL filter right now.  The same is true if the issues were deleted from JIRA. 

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,091 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