Whether we like it or not, Atlassian Jira is often the tool of choice to run large software projects. It may or may not be your kind of a “pie”, but if you have to use it, it’s at least useful to understand some of the powerful capabilities it provides. Over years, I have come to sincerely appreciate Jira’s support of flexible quering of its data and ability to create powerful dashboards with the use of that data, using a proprietary query language - JQL.

Further in this post, we will list some of the advanced query expressions and JQL examples that have been useful in our experience.

Please note that a lot of examples in this blog post require the presence of Adaptavist Scriptrunner functions, which can be easily installed in SaaS version of Jira, via “Applications” and is a common plugin enabled in self-hosted server addition of Jira, as well.

Project Dependencies: Stories of Specific Kind linked to Epic with Conditions

Let’s say we are analyzing cross-dependencies across projects. More specifically, let’s say we want to understand regulatory-requirements related dependencies that Shipping has on Billing. So we want to find all stories with component=Regulatory in billing project that are linked to an epic in the Shipping project:

project = BIL AND type = Story AND Component = Regulatory 
AND issueFunction in issuesInEpics("project = SHIP")

We can also write this query in a more generic way, by reversing subquery and using parentsOf() function:

type = Epic AND project = SHIP AND 
issueFunction in parentsOf(
  "project = BIL AND type = Story AND Component = Regulatory"
  )

This allows to query for any parent/child relationships (e.g. Epic vs Initiative) and not just Story/Epic one.

Bigger Picture: Epics Of Stories Satisfying Specific Condition

In the previous example, we saw two ways of finding stories for certain kind of epics. Let’s say we need the opposite - finding epics of certain kind of stories.

An example of this is if we want to create a high-level view of a release. Let’s assume our teams have a rule that stories must be sized so that they are aligned with release, but sprints can span multiple releases. In such a scenario, it makes sense to assign release (typically: fixVersion in Jira) to stories, but not necessarily to epics.

Question: what are topics addressed in a release? Which can be represented in: what are all the epics that have a closed or in-progress story that has fixVersion of the current release?

Let’s say fixVersion of current release for Billing is BIL_20230605. Then the query we need may look like the following:

project = BIL and type = epic issueFunction in linkedIssuesOf("
type in (Story) and fixVersion = 'BIL_20230605' ")

This JQL should give you all the epics that have at least one story in the specified release (fixVersion). Such view can be very helpful if you want to get a high-level (epic-level) view of work that is in the release, rather then getting bogged-down into the detailed view of stories.