Swiftorial Logo
Home
Swift Lessons
Matchups
CodeSnaps
Tutorials
Career
Resources

JQL Basics

Introduction to JQL

JQL (Jira Query Language) is a powerful tool in Jira that allows you to create tailored queries to find issues in your project. It offers a wide range of query capabilities, enabling you to search for Jira issues based on various criteria such as project, assignee, status, and more.

Basic Syntax

The basic syntax of a JQL query consists of a field, an operator, and a value. Here's the general structure:

field operator value

For example, to find all issues assigned to a user "john.doe", you would write:

assignee = "john.doe"

Common Fields and Operators

Let's look at some of the most commonly used fields and operators in JQL.

Fields

  • project - The project key or ID.
  • assignee - The person to whom the issue is assigned.
  • status - The current status of the issue.
  • priority - The priority level of the issue.
  • created - The date the issue was created.

Operators

  • = - Equal to.
  • != - Not equal to.
  • in - Value is in a list of values.
  • not in - Value is not in a list of values.
  • >= - Greater than or equal to.
  • <= - Less than or equal to.
  • ~ - Contains (used for text fields).

Examples of Basic Queries

Find Issues by Project

To find all issues in a project with the key "PROJ", you would write:

project = "PROJ"

Find Issues by Assignee

To find all issues assigned to "john.doe", you would write:

assignee = "john.doe"

Find Issues by Status

To find all issues that are currently "In Progress", you would write:

status = "In Progress"

Combining Conditions with AND/OR

JQL allows you to combine multiple conditions using the AND and OR keywords.

Using AND

To find all issues in the "PROJ" project that are assigned to "john.doe", you would write:

project = "PROJ" AND assignee = "john.doe"

Using OR

To find all issues that are either assigned to "john.doe" or have a priority of "High", you would write:

assignee = "john.doe" OR priority = "High"

Advanced JQL Functions

JQL also supports more advanced functions for more complex queries.

Finding Issues Created in the Last 7 Days

To find all issues created in the last 7 days, you would use the created field with the greater than operator and the startOfDay() function:

created >= startOfDay(-7d)

Finding Issues Due in the Next Week

To find all issues that are due in the next week, you would use the due field with the less than operator and the endOfDay() function:

due <= endOfDay("+7d")

Ordering Results

You can order the results of your JQL query using the ORDER BY clause.

Order by Created Date

To order the results by the created date in descending order, you would write:

project = "PROJ" ORDER BY created DESC

Order by Priority and Created Date

To order the results first by priority and then by created date, you would write:

project = "PROJ" ORDER BY priority ASC, created DESC

Saving and Using Filters

Once you have crafted your JQL query, you can save it as a filter for easy access in the future.

Saving a Filter

After running your JQL query in Jira, click on the "Save as" button to save your filter. Give your filter a name and description, and specify any necessary permissions.

Using a Saved Filter

To use a saved filter, go to the "Filters" menu in Jira and select "View all filters". From there, you can search for and select your saved filter to view the results.

Conclusion

JQL is a powerful tool in Jira that allows you to create customized queries to find exactly the issues you are looking for. With the basics covered in this tutorial, you should be well on your way to mastering JQL and improving your productivity in Jira.