Learn how to succeed in your role as a service desk agent.
Write JQL queries for SLAs
JQL queries have an order of elements that need to be followed when creating SLAs (service level agreements). There are also functions that are frequently used when creating SLA queries, commonly used operators and certain characters and words that have been reserved in Jira to perform specific functions in the query. Learn more about Advanced search reference - JQL fields.
Elements in a query
In JQL, a query has four basic elements:
Fields are different types of information in the system. For example, a Jira Service Desk field may be priority, issue type, date created and project.
Operators are the heart of the query. They relate the field to the value. Common operators include equals (=), not equals (!=) and less than (<).
Values are the actual data in the query. For example, paused() and remaining(“2h”).
Functions are special calculations within Jira to access specific data. For example, issues that have breached SLAs.
You can optionally link a query together using a few select keywords. Keywords are specific words in the language that have special meaning. For example, this may be AND and OR.
A simple query in JQL consists of a field, followed by an operator, followed by one or more values or functions. For example:
The query above finds all issues in the Test project. It uses the project field, the EQUALS operator, and the value Test.
Commonly used functions when writing SLA queries
The following are functions that are commonly used when writing JQL queries for an SLA:
This filters out issues where the last SLA cycle has failed to meet its target goal.
This filters out issues that have failed to meet their target goal.
This filters issues where the current SLA cycle is paused due to a particular condition. For example, you may pause an issue's SLA clock when the issue's status is set to waiting for customer.
This filters issues where the SLA cycle is complete, meaning the issue has reached one of their stop events.
This filters issues where the current SLA clock is running, meaning the issue haven't yet reached one of the stop events.
This filters issues whose SLA clock is running or not running according to the SLA calendar, not conditions.
This filters issues where the SLA cycle's clock meets a specified time condition since the ongoing SLA cycle's start event.
This filters issues whose SLA cycle's clock meets a specified time condition before the issue will breach an SLA goal.
Commonly used operators
Here are some common character and word operators that you can use in your SLA JQL query:
=, >, >,=, ~, != < <= !~
not, in, is not, was, not, was not, in, not in, is, was, was in, changed
Reserved characters and words
Here are some reserved characters and words in Jira that need to be used in a specific manner when using them in a query.
space (" "), +, ., ;, ?, |, *, /, %, ^, $, #, @, [ ], ,
a, and, are, as, at, be, but, by, for, if, in, into, is, it, no, not, of, on, or, s, such, t, that, the, their, then, there, these, they, this, to, was, will, with
When using reserved characters or words in your queries, you need to:
surround them with quote marks. You can use either single or double quote marks. For example, ‘Time to first response’.
if you are searching a text field and the character is on the list of reserved characters or words, precede them with two backslashes. For example, \\'Time to first response'.
Was this helpful?