What is Jira Query Language (JQL)?

Jira Query Language (JQL) is a text-based query language used to extract specific data from the Jira database. Jira is a swamp of tickets that can weigh you down in the mud of ambiguity, but JQL can help you navigate once you know the syntax. With JQL, you can create structured queries to retrieve the desired issues based on various criteria.

Why Is JQL Essential?

  1. Search for Issues: Use JQL to search for issues based on project name, issue type, status, assignee, priority, and more.
  2. Operators and Functions: JQL supports a range of operators to compare values, combine conditions, and perform text matching.
  3. Agile Project Management: JQL is particularly valuable for agile teams, as it maintains clarity and alignment among team members and stakeholders.
  4. Quick Access to Information: JQL enables quick access to relevant information, allowing you to focus on essential tasks.

Examples of Basic JQL Queries:

  1. Project-Based Query:
    • To find all issues in the “My Project” project:
      project = "My Project"
  2. Assignee Query:
    • To retrieve issues assigned to the currently logged-in user:
      assignee = currentUser()
  3. Status Query:
    • To get issues with the status “In Progress”:
      status = "In Progress"

Examples of More Complex JQL Queries:

  1. Complex User-Related Query
    • To retrieve child issues from multiple parent links (e.g., parent links with keys EX-000, EX-001, EX-002, EX-003):
      Parent Link" IN (EX-000, EX-001, EX-002, EX-003)
      This query will return all child issues associated with the specified parent links.
  2. Child Issues Query:
    • To get all child issues below a specific epic (e.g., epic key INIT-00) regardless of their hierarchy level:
      issue in linkedIssues(INIT-00, “is Epic of”)
      This query ensures you retrieve all child issues, even if nested within other epics or stories.
  3. Complex User-Related Query
    • To find all issues in the “TEST” project where the assignee is the currently logged-in user:
      project = “TEST” AND assignee = currentUser()
      This query combines the project field, the EQUALS operator, the value “TEST,” the AND keyword, and the currentUser() function.

Using Atlassian Intelligence (AI) for JQL:

Atlassian Intelligence (AI) is a virtual teammate integrated into Jira Cloud products. It translates your natural language queries into JQL code, making it easier to search for issues. Here’s how to use it:

  1. Go to the issue navigator in your Jira project.
  2. Select the AI option next to the search bar.
  3. Type your query in simple language (e.g., “Epics labelled XYZ”).
  4. Click “Go” to have AI translate it into JQL.

AI works best when:

  • You’re querying using issue fields available in your Jira project.
  • The query has specific fields and values to narrow down your search.

Using Copilot for Generating JQL:

Copilot is a great tool for generating scripts using languages like JQL. To use it, all you need to do is ask for what you need in plain English. It’s easy to get started with any AI, and you’ll learn as you go. Don’t be afraid, as you really can’t mess anything up.

Sample Prompt:

write me a jql script for jira cloud to find bug tickets created on 2024-04-19 with the text "file type" in project "project-x" ordered by date created

Output:

project = "project-x" AND issuetype = bug AND created >= 2024-04-19 AND created <= 2024-04-19 AND text ~ "file type" ORDER BY created ASC

To execute the JQL query in Jira Cloud, follow these steps:

To execute the JQL query in Jira Cloud, follow these steps:

  1. Log in to your Jira Cloud account: Open your web browser and navigate to your Jira Cloud instance. Log in using your credentials.
  2. Navigate to the Issue Search page:
    • Click on the “Search” icon (usually represented by a magnifying glass) in the top navigation bar.
    • Select “Advanced search” from the dropdown menu.
  3. Enter the JQL query:
    • In the “Advanced search” page, you’ll see a text box where you can enter your JQL query.
    • Copy and paste the following query into that box:
      project = "project-x" AND issuetype = bug AND created >= 2024-04-19 AND created <= 2024-04-19 AND text ~ "file type" ORDER BY created ASC Replace "project-x" with the actual name of your project.
  4. Run the search:
    • Click the “Search” button to execute the query.
    • Jira will display the search results based on the criteria specified in your query.
  5. Review the results:
    • You’ll see a list of bug tickets that match your search criteria.
    • The results will be ordered by their creation date in ascending order.

Helpful Resources

Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http://www.unlatched.com/#sthash.8DiTkpKy.dpuf

Posted in AI, Copilot, How To, Skills, Uncategorized Tagged with: , , , , , , ,