JQL for JSM queues: examples that work

Tested JQL for JSM queues: unassigned, mine, waiting for customer, SLA breached or about to breach, request type, organization, channel and approvals.

A queue in Jira Service Management is a JQL query that runs inside one service space (Jira’s name for a JSM project). Once you know the fields and functions JSM adds to JQL, for SLAs, request types, organizations, channels and approvals, you can build almost any queue your team needs.

Below is a library of queue JQL with a line on what each does. We ran every query on a JSM Cloud site to check it; swap in your own status, request type and organization names. After the library: common errors, what JQL can’t do in a queue, and how Advanced Queues uses JQL.

Where queue JQL goes

  1. Next to Queues in your space, select More actions (•••), then Queue settings.
  2. Select Create new queue, or open a queue and select More actions > Edit queue.
  3. In the Filter by section, select Advanced and type the JQL. As you type, a live preview shows the matching requests.

You need to be a space admin (create a queue). Leave out the project clause: a queue only ever shows its own space’s requests.

Everyday queues

Unassigned requests, oldest first:

assignee IS EMPTY AND resolution = Unresolved ORDER BY created ASC

Assigned to me. One queue gives every agent their own list:

assignee = currentUser() AND resolution = Unresolved ORDER BY "Time to resolution" ASC

Waiting for the customer, longest wait first:

status = "Waiting for customer" ORDER BY updated ASC

Waiting for the customer for more than five days, ready for a reminder or to close:

status = "Waiting for customer" AND updated <= -5d

Waiting for us. In JSM’s default workflows, Waiting for support means the team owes the next reply:

status = "Waiting for support" AND resolution = Unresolved ORDER BY "Time to resolution" ASC

SLA queues

Each SLA is a field named after it, such as Time to first response or Time to resolution, and SLA fields take their own functions (JQL functions).

Breached and still open:

"Time to resolution" = breached() AND resolution = Unresolved

breached() checks the SLA’s most recent cycle. For “missed at any point”, use everBreached(), which suits reviews more than queues.

About to breach in the next two hours:

"Time to resolution" < remaining("2h") AND "Time to resolution" != breached() AND resolution = Unresolved

Don’t skip the middle clause. On its own, remaining("2h") also matches requests that have already breached, since their time left is below two hours as well. In our test it returned breached requests and nothing else.

Waiting more than an hour for a first response:

"Time to first response" = running() AND "Time to first response" > elapsed("1h")

SLA clock paused by one of its conditions, such as a status the SLA pauses on:

"Time to resolution" = paused()

SLA running inside its calendar’s working hours right now:

"Time to first response" = withinCalendarHours()

running() ignores the calendar. withinCalendarHours() only returns SLAs whose calendar is open, which helps teams that cover several time zones.

To put the most urgent requests at the top of any queue, end it with ORDER BY "Time to resolution" ASC.

Request type, organization and channel

One request type:

"Request Type" = "Get IT help" AND resolution = Unresolved

Several request types:

"Request Type" IN ("Request a new account", "Get IT help") AND resolution = Unresolved

Requests shared with an organization:

organizations = "Harbor Logistics" AND resolution = Unresolved

That misses requests a customer kept private instead of sharing with their organization. To catch everything its members sent:

reporter in organizationMembers("Harbor Logistics") AND resolution = Unresolved

Requests that came in by email:

request-channel-type = email AND resolution = Unresolved

Other values include portal, jira (created in Jira itself) and api. Requests from customers who weren’t logged in to the portal have a channel value of their own, so check the full list on Atlassian’s JQL fields page before you exclude one with !=.

Approvals

Waiting on any approval step:

approvals = pending()

Waiting on your own decision, for an approver’s queue:

approvals = myPendingApproval()

Approved but not finished:

approvals = approved() AND resolution = Unresolved

To see requests waiting on a particular approver, pendingApprovalBy() takes one or more people; pick them from the autocomplete.

Requests the customer just answered

JQL can’t tell who wrote a comment. comment ~ searches comment text, and updatedBy() needs one specific person, so neither gives you “the customer replied”.

The usual answer is a status. JSM can move a request from Waiting for customer to Waiting for support when the customer comments: service spaces on Legacy automation have a preset rule for it (Comment updates reply status), and an automation rule with the Work item commented trigger does the same. With that in place, this lists the requests customers answered in the last day:

status = "Waiting for support" AND status CHANGED FROM "Waiting for customer" TO "Waiting for support" AFTER -1d

Common JQL errors in queues

Names with spaces need quotes. Without them, Jira stops at the first reserved word:

status = Waiting for customer

fails with “Error in the JQL Query: ‘for’ is a reserved JQL word. You must surround it in quotation marks to use it in a query.” An unquoted SLA name fails the same way: Time to resolution = breached() gives “Expecting operator but got ‘to’”. Write status = "Waiting for customer" and "Time to resolution" = breached().

Request type names. Use the request type’s name exactly as you set it up. Autocomplete may show the space key after it, as in “Get guest wi-fi access (MFSD)”, and Jira stores the value as the portal key and request type key, such as "sd/system-access".

Status or status category. status = Done matches only a status called Done. statusCategory != Done matches every status outside the Done category, whatever it’s called. Team-managed service spaces have no Resolution field, so use statusCategory != Done there instead of resolution = Unresolved (JQL fields). In company-managed spaces, resolution = Unresolved relies on your workflow setting a resolution when work is done; if it doesn’t, finished requests stay in the queue.

ORDER BY. Put it once, at the end, with as many fields as you need: ORDER BY "Time to resolution" ASC, created ASC. It sets the queue’s default order. Agents can still sort a queue by selecting a column name.

Spaces and projects. A project clause can’t widen a queue beyond its space. Atlassian’s docs also warn that JQL using the new word space may not work everywhere yet, while project does.

What JQL can’t do in a queue

  • Span spaces. A queue shows one space only, whatever its JQL says.
  • Group rows. Grouping is limited in a queue’s list. The list in Multi-space work, JSM’s view across spaces, can group by field.
  • Follow the conversation. No JQL field knows who commented last or how often the customer wrote.
  • Search comments from the search bar. The queue’s search bar skips comments and work logs. Use comment ~ in the JQL instead.
  • Stay fast with heavy queries. Atlassian’s queue guidance prefers several simple queues to one complex one, and warns against text searches such as summary ~ "fault", complex functions and JQL functions from apps. It also suggests showing only recent work items in big queues: updated >= -14d keeps the last two weeks.

The Community question behind many of these searches is a simple one: there’s no JQL field for “in this queue”. To reuse a queue elsewhere, copy its JQL.

Write queue JQL in Advanced Queues

Advanced Queues for Jira Service Management defines every queue with JQL too: type it, or build it with the JQL builder (creating a queue). The queries above work there too, with one difference: an Advanced Queues queue isn’t tied to the space it lives in, so its JQL searches every project you can see. Start each query with a project clause, such as project = ITSD AND assignee IS EMPTY AND resolution = Unresolved. Its docs show a queue sorted by SLA with resolution = Unresolved ORDER BY "Time to resolution" ASC.

The difference is reach. Multi-space work lists requests from several spaces, but it isn’t a queue. Advanced Queues includes cross-project queues (pricing), so one queue’s JQL can name several service projects:

project in (ITSD, HRSD) AND "Time to resolution" < remaining("2h") AND "Time to resolution" != breached()

Each queue also gets its own columns and a priority, sits in a folder of your choice, and has a link that opens its JQL in Jira search.

Questions

Should every agent have a personal queue?

Usually not. Atlassian suggests one queue built on assignee = currentUser() instead, because every extra queue is one more for the whole team to load.

Can the queue search bar find text in comments?

No. It searches most text fields but not comments or work logs. Put comment ~ "error 503" in the queue’s JQL, or run it in Jira search.

Can I copy a queue’s JQL into a filter?

Yes. Copy it from the queue’s edit screen into Jira search and add a project clause, because a filter isn’t tied to one space the way a queue is.

Why does my SLA query return nothing?

Check that the SLA name matches one in the space and is in quotes, such as "Time to first response". Custom SLAs use the names you gave them.

Try Advanced Queues for Jira

Master your queues with enhanced cross-project visibility.