Regardless of your role – whether you are a developer, tester, project manager or business analyst – it is always good to have a quick access to the specific data that you want to work with. Let’s find out more about the JIRA Query Language – a powerful tool which can help you improve your work efficiency.
Why to learn JQL:
- It makes your job more efficient.
- It gives you quicker access to the data you are looking for.
- It helps you find out what the status of the sprint/project is.
- It’s easy and intuitive.
- You simply need it!
How to find and apply Advanced Search:
Now you are good to go and write JQL queries!
Query – how to write them?
Queries are series of questions connected together so it gets more complex. The main function of a query is to obtain the desired data from the database.
Query has three basic parameters: field, operator and value, which can be linked with the selected keywords.
Fields are different types of fields in JIRA filters, such as priority, fixVersion, assignee.
Operators link the field with the value. Common operators include: equals (=), not equals (!=), less than (<) etc.
Value is the real data in the query, which usually is the data you are looking for.
Keyword is a specific word in the query, such as AND, OR etc.
Let’s go through a few examples of queries that might be useful for you on a daily basis:
- What are the issues from the JQLProjectExample project?
The query would look as below:
The result of this search are all the issues raised in the project named ‘JQLProjectExample’.
- What are the bugs from the ‘JQLProjectExample’ project?
The query would look like that:
project = JQLProjectExample AND type = Bug
The result of that query are all the issues from the ‘JQLProjectExample’, which are bugs.
- Which of the production bugs assigned to ‘John Smith’ Developer have been reported by ‘Arvel Callahan’ (QA)?
project = JQLProjectExample AND type = BugPRD AND assignee = John Smith AND reporter = Arvel Callahan
- Which issues are blocking or critical in Projects X, Y and Z?
priority in (Blocker, Critical) AND project in (ProjectX, ProjectY, ProjectZ)
Note, that the “in” keyword will include any item which matches any item in the list.
- Which of the issues are not assigned to anyone among all the projects you have available in JIRA?
assignee is EMPTY
- Which of the issues were already tested in the ‘Sprint1’ and are not in the ‘XYZ’ project
project != XYZ AND status = tested AND sprint = Sprint1
- Which of the issues contain text ‘code’ in the title of the issue?
text ~ "code"
Functions give the user power to manage the JIRA issues in an easy way.
Below, couple of especially useful ones:
- What are the issues that have been created during the current session in JIRA?
created > currentLogin()
- What are the issues that have been created by the currently logged since the user’s previous session?
created > lastLogin()
- What are the issues that are assigned to a sprint that has not yet been completed?
sprint in openSprints()
- What are the issues that are not sub-tasks?
issuetype in standardIssueTypes()
- What are the issues created since the start of the day?
created > startOfDay
The same rule applies to a month, week, and year.
Here you can find more functions.
If the query produces many results, you might want them sorted (ordered) by a specified field. Thanks to this, you can analyze data (and, based on that, take proper actions) more easily.
What are the bugs in the ‘XYZ’ project, assigned to Peter James (developer), ordered by the highest priority?
project = XYZ AND assignee = Peter James AND type = Bug ORDER BY priority
After mastering writing the queries, it is high time to save and collect your efforts.
Saving queries gives you a quick access to the data you need, saving plenty of time.
Let’s create a filter based on JQL:
- Once you have entered the query, click the ‘Save as’ button, which is located just above the field where you type.
- Give it a name and click the ‘Submit’ button.
- Go back to the main page of JIRA. In the upper- right corner, there is a list of your saved filters.
- Click the filter that you have saved and the issues will be filtered.
- It is possible to edit permissions and share the filters with your co-workers. To do so, click on the saved filter from the main JIRA site. Next to the filter’s name there is the ‘Details’ button. Click it and then click ‘Edit permissions’
- You will be transferred to the view where you can change the name of your filter, add description or share it with a group or project.