Home / JQL functions / previousSprint()

previousSprint() JQL function for Jira Cloud

Last updated 20/11/2026. Hooks is our product, and this page describes how its built-in function behaves.

previousSprint() returns the work items in a board's most recently completed sprint. Syntax: issue in previousSprint("board name or ID"). Unlike the other built-ins it takes a board, not an inner JQL. Only sprints created on that board count.

Try Hooks free for 30 days → All 15 functions

Syntax

issue in previousSprint("board")

The work items in a board's last completed sprint. The function name is not case sensitive in the search bar, and you can use it anywhere Jira accepts JQL: the search bar, saved filters, boards, dashboard gadgets and subscriptions.

Arguments

ArgumentWhat it does
boardRequired. The board's name or its ID, the number in the board's URL. A name shared by several boards is an error, so use the ID.

What it returns

Sprint reviews and retros need "what was in the last sprint" without anyone hunting for the sprint name or number. previousSprint always points at the latest completed one, so a saved filter built on it never needs editing. It needs the app's read access to boards and sprints, which was added in 3.0.0; a Jira admin approves the update once.

Three worked examples

Board filter: carry-over from last sprint

issue in previousSprint("Platform Team board") AND resolution is EMPTY

The sprint planning board shows everything unfinished from the last completed sprint, ready to re-plan.

Dashboard gadget: last sprint's unresolved bugs

issue in previousSprint("42") AND issuetype = Bug AND resolution is EMPTY

Using the board ID avoids ambiguity when several boards share a name.

Automation: retro prep

issue in previousSprint("Web board") AND timespent > 0

A rule scheduled after each sprint can gather last sprint's work with logged time for the retro page.

Saving it as a filter

There is nothing app-specific to save. Compose the query in Jira's own search bar, save it as a normal Jira filter, and use that filter on boards, dashboards, gadgets and subscriptions. The JQL functions tab in Hooks has a Try a search panel that previews the first matches of a query before you save it, which is a quick way to check the inner JQL does what you expect.

Using not in

Every built-in function returns the correct set for not in. issue not in previousSprint(...) matches every work item except the ones the function returns. not in also returns work items that were never in a sprint.

issue not in previousSprint("board")

Limits you will see

ScriptRunner equivalent

In ScriptRunner you write issueFunction in previousSprint(...). In Hooks you write issue in previousSprint(...), and issueFunction not in becomes issue not in. The name and the board argument carry over unchanged. Saved Enhanced Search filters can be converted in place from the Migrate from ScriptRunner tab, which checks each one against ScriptRunner's current results first. See the migration docs and the Enhanced Search alternative guide.

Related functions

Frequently asked questions

Should I use the board name or the ID?

Either works. If several boards share a name the function returns an error, so use the ID, the number in the board's URL.

What if the board has no completed sprint?

It matches nothing. The same is true for a board without sprints, such as Kanban.

How many work items can previousSprint() return?

Up to 12,000. The inner search scans up to 25,000 matches, and a bigger result shows too many results instead of a cut-off list.

What is the ScriptRunner equivalent of previousSprint()?

Replace issueFunction in with issue in. The name and the board argument carry over unchanged.

Try Hooks free for 30 days → Docs: JQL functions