Cheat Sheet #day6 - JQL (Jira Query Language)

Cloud TunedCloud Tuned
4 min read

JQL (Jira Query Language) Cheat Sheet

Jira Query Language (JQL) is a powerful tool in Jira for searching and filtering issues based on various criteria. This cheat sheet provides a quick reference to common JQL functions and operators to help you create effective queries.

Basic Syntax

  • Field: Represents an issue field (e.g., status, assignee).
  • Operator: Defines the relationship between the field and the value (e.g., =, !=, ~).
  • Value: The value to match against the field.

Common Fields

  • Project: project
  • Issue Type: issuetype
  • Status: status
  • Assignee: assignee
  • Reporter: reporter
  • Priority: priority
  • Labels: labels
  • Components: component
  • Resolution: resolution
  • Created Date: created
  • Updated Date: updated
  • Due Date: duedate
  • Custom Fields: Use custom field name or ID (e.g., cf[12345])

Basic Operators

  • Equals: =
  • Not Equals: !=
  • Greater Than: >
  • Greater Than or Equal To: >=
  • Less Than: <
  • Less Than or Equal To: <=
  • In: IN
  • Not In: NOT IN
  • Contains: ~
  • Does Not Contain: !~
  • Is: IS
  • Is Not: IS NOT
  • Was: WAS
  • Was In: WAS IN
  • Was Not In: WAS NOT IN
  • Changed: CHANGED

Combining Conditions

  • AND: Combines multiple conditions (both must be true).
  • OR: Combines multiple conditions (either can be true).
  • NOT: Negates a condition.
  • (): Groups conditions to form complex queries.

Examples

  • Find issues in a project:

    project = "MyProject"
    
  • Find issues assigned to a user:

    assignee = "john.doe"
    
  • Find issues with specific status:

    status = "In Progress"
    
  • Find issues created by a user:

    reporter = "jane.doe"
    
  • Find issues created in the last 7 days:

    created >= -7d
    
  • Find issues updated in the last 24 hours:

    updated >= -24h
    
  • Find issues with priority "High" or "Critical":

    priority IN ("High", "Critical")
    
  • Find issues that do not have a resolution:

    resolution IS EMPTY
    
  • Find issues with a specific label:

    labels = "bug"
    
  • Find issues in a specific component:

    component = "UI"
    
  • Find issues due in the next 5 days:

    duedate <= 5d
    
  • Find issues where summary contains a keyword:

    summary ~ "performance"
    
  • Find issues where description does not contain a keyword:

    description !~ "outdated"
    
  • Find issues with a custom field value:

    "Custom Field Name" = "Value"
    
  • Find issues that changed status in the last 2 days:

    status CHANGED TO "Done" AFTER -2d
    
  • Combine conditions:

    project = "MyProject" AND status = "Open" AND assignee = "john.doe"
    

Advanced Examples

  • Find issues resolved by a specific user in the last month:

    resolution = "Done" AND resolved >= startOfMonth(-1) AND resolved < startOfMonth() AND assignee = "john.doe"
    
  • Find issues that were reopened:

    status WAS "Reopened"
    
  • Find issues with attachments:

    attachments IS NOT EMPTY
    
  • Find issues that have been transitioned to "In Progress":

    status CHANGED TO "In Progress"
    
  • Find issues that have a specific watcher:

    watcher = "john.doe"
    

Date Functions

  • startOfDay(): Beginning of the current day.
  • endOfDay(): End of the current day.
  • startOfWeek(): Beginning of the current week.
  • endOfWeek(): End of the current week.
  • startOfMonth(): Beginning of the current month.
  • endOfMonth(): End of the current month.
  • startOfYear(): Beginning of the current year.
  • endOfYear(): End of the current year.

Useful Tips

  • Autocomplete: Use JIRA’s autocomplete feature by typing Ctrl + Space to see available fields and values.
  • Saved Filters: Save commonly used JQL queries as filters for quick access.
  • Permissions: Ensure you have the necessary permissions to access the issues and fields you are querying.

This cheat sheet provides a quick reference to help you craft powerful JQL queries for efficiently searching and filtering issues in Jira. For more complex queries and detailed documentation, refer to the Jira documentation.

0
Subscribe to my newsletter

Read articles from Cloud Tuned directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Cloud Tuned
Cloud Tuned