Filter Issues that are Open+Blocking OR Blocked by Open Issues

Marc Moroz December 21, 2017

Hi

We have ScriptRunner available, if it helps.  We're trying to find issues that are:

  1. Open AND Blocking Open Issues (don't show issue if only blocking Done issues)
  2. Open AND Blocked by Open Issues (don't show issue if blocking issues are Done)

 

In other words, my current search returns an issue that is "blocked" but the blocking item is done.  In this case, I don't consider the issue to be blocked anymore because the blocker is Done.

 

Current Filter

issueFunction in hasLinks("is blocked by") or issueFunction in hasLinks("blocks") 

 

5 answers

6 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 22, 2017

So, I think you're about half way there.  The hasLinks JQL function provided by scriptrunner can help you find those issues.  But you then also need to lookup the status of those linked issues to be able to make sure you don't include blocked issues that are already in a status of "Done".   Fortunately, it looks like scriptrunner does have another function called linkedIssueOf that can help here.

(issueFunction in hasLinks("is blocked by") AND issueFunction in linkedIssuesOf("status != Done", "blocks")) OR (issueFunction in hasLinks("blocks") AND issueFunction in linkedIssuesOf("status != Done", "is blocked by"))

I think that this JQL query, with scriptrunner of course, can help with locating the issues you are wanting to see here.

Andre Untiedt November 6, 2019

Jira 8:  "is blocked by" -> "depends on"

1 vote
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 18, 2019

Hi @[deleted] 

Not exactly.   It is true that with Jira 8.0.0, there is a new JQL search feature that will let you search for Jira issues that have a specific link type.  More details in  Advanced Searching: Field reference: Issue link type.

However this does not extend itself to let you search both the issues that have links and the linked issues status in a single query.

You would have to formulate the query to return specific issues, instead trying to use native Jira JQL to lookup related issue values.  This is something that plugins like scriptrunner can do because they are utilizing other code to return such results.

You could create a query such as

status=open and issuelinktype in (blocks)

Just to see issues in that state with at least one linktype of blocks.   But since we can't lookup the linked issue status, you could try something like

issuelinktype in ('is blocked by') and status=open

This would return the issues that have the reciprocal link type and their status, but again it won't show you the status of the issues on the other side of that link.  

I hope this helps.

Andy

Kenneth Bingham September 3, 2019

That's great to hear Andy! We've been wanting something like this for a while. I gave JQL Pro (formerly Plus?) a go and ran into limitations in the query syntax. It supports a subset of Mongo query language. I've since uninstalled that app due to that limitation.

Even with that, and with the new issue link operators in advanced search, I wasn't able to build filters that answer questions like: Which issues in this project...

  1. ... were previously blocked by issues that are now done?
  2. ... are blocking issues in another project?
  3. ... are blocked by issues that are still not done?

I was able to express this logic in JQL Pro/Plus with MQL, but the app's implementation was buggy and it didn't seem worthwhile to pursue fixes there.

To save time during backlog refinement we have widgets in Confluence that display filters like these. Widgets for #1 and #3 could be addressed by a simple "is blocked by" filter, but in reality they deserve very different levels of attention, hence the further conditional of whether the blocking issue is done.

To address these limitations I wrote a Python script which we're refining and plan to install somewhere that it can run at interval to update these filters when it stabilizes.

We're using JIRA to manage a Scrum backlog which I imagine is fairly common, and so maybe this script will be useful to someone else. Even if not, I hope the otherwise unanswerable questions above will generate some feedback. Maybe I've overlooked something in advanced search?

For our backlog, we're using a label to "bless" issues that are sufficiently well-defined to be accepted for development, and so we don't need to see those issues when we're refining the backlog, just the issues that need attention. It's easy enough to exclude issues based on a label in JQL, and the Python script uses that with an option like `--exclude-labels blessed`.

Like Askar Akhmerov likes this
0 votes
Lazarus Mfati March 16, 2022

I want to be able to identify issues that are blocked by other tickets..Please help

0 votes
michael sam May 8, 2020

I am trying to write a query that can address issues blocked across 2 projects.

I am working in the cloud

issueLinkType = "is blocked by" AND project = " " OR project = " " AND "Epic Link" in () OR ParentEpic in () ORDER BY Rank ASC

This query doesn't seem to filter only the issues blocked is it set up wrong?

Its giving me all the issues associated with the epic link and parent link associated with both projects which is good but i only want the issues that are blocked by

Also is there way to write it specifically only for status that is open?

status = Open AND issuelinktype = "is blocked by" AND project = " " OR project = " " AND "Epic Link" in () OR ParentEpic in () ORDER BY Rank ASC

appreciate feedback

Thanks

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 8, 2020

I think that one of the OR operators is pulling in more issues that you expect here.  Instead of using

issueLinkType = "is blocked by" AND project = " " OR project = " " AND "Epic Link" in () OR ParentEpic in () ORDER BY Rank ASC

 

Try instead:

(issueLinkType = "is blocked by" AND project in (ABC, XYZ)) AND ("Epic Link" in () OR ParentEpic in ()) ORDER BY Rank ASC

This should return all the issues in either project XYZ or ABC that have at least one link type of 'is blocked by' and is in the epic selected. 

Does this help?  Or did I misunderstand which issues you are expecting to return from that query?

Let me know,

Andy

michael sam May 11, 2020

Andy,

I appreciate the feedback

I tried using

issueLinkType = "is blocked by" AND project in (" USIT", " eCommerce") AND "Epic Link" in (USIT-755, ECOMM-1182) OR ParentEpic in (usit-755, ecomm-1182) ORDER BY Rank ASC

 

the results gave all 74 issues belonging to these epics but it didn't isolate the ones "is blocked by"

I am trying to isolate dependency between projects is blocked by, block by, has to be before etc. anything coming from the drop menu in linked issues.

I am working in the cloud I have tried a bunch of combination JQLs I still cant isolate

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2020

Right, but because you're not isolating the OR keyword inside an set of parenthesis, Jira is not expected to only honor the previous statements to get a match there.  The statement you have there is expected to return all issues with the parentepic of either of those two issues, regardless of links, but it will also return some other issues that have the links you specified.

Which is why I believe that changing your query to

issueLinkType = "is blocked by" AND project in (" USIT", " eCommerce") AND ("Epic Link" in (USIT-755, ECOMM-1182) OR ParentEpic in (usit-755, ecomm-1182)) ORDER BY Rank ASC

will help show you the results I think you are looking for here.

michael sam May 12, 2020

Andy, this worked but I am still experiencing some issues

issueLinkType in ("is blocked by") AND status = "Not Started" AND project in (" USIT", " eCommerce") ORDER BY Rank ASC

This provided "is blocked by" in both projects overall 

The goal was to find "is blocked by" across 2 projects with shared epics.

When I tried to use epic links and parent epics it all issues associated with the epic not just the issueslinketype "is blocked by" shared between the projects

issueLinkType in ("is blocked by") AND status = "Not Started" AND project in (" USIT", " eCommerce") AND "Epic Link" in (ECOMM-3508, ECOMM-3509, ECOMM-12477, USIT-501, USIT-533, USIT-554, USIT-581, USIT-601, USIT-650, USIT-746, USIT-755, USIT-761, USIT-1089) OR parentEpic in (ECOMM-3508, ECOMM-3509, ECOMM-12477, USIT-501, USIT-533, USIT-554, USIT-581, USIT-601, USIT-650, USIT-746, USIT-755, USIT-761, USIT-1089 ORDER BY Rank ASC

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2020

Hi Michael,

Thanks for explaining in more detail what you are looking for here.  I don't think that Jira by itself will be able to give you exactly what you are looking for here.  The reason is that, when this query runs, it is not looking up any of the issue details of the linked issues here.  It's only returning issues that match the criteria there.  This means that we can't tell where the linked issues are linked to in terms of what project/epic they might belong to.  We can only tell if the issue has at least one link of that type when searching by JQL.

That said, you might be able to use a JQL subquery of sorts if you were to use a 3rd party app/plugin for Jira Cloud. If you were using Jira server, I know that scriptrunner can do this as documented in https://scriptrunner.adaptavist.com/6.0.1/jira/jql-functions.html#_linkedissuesof But since you are in Cloud, that plugin doesn't have the same features there.

Instead I believe JQL Search Extensions for Jira & reports can do something like this, but there might be other solutions in marketplace as well.  It has some more documentation over in https://jqlsearchextensions.atlassian.net/wiki/spaces/SEARCH/pages/173211649/Subqueries+-+Jira+Cloud#Subqueries-JiraCloud-linkedByQuery It looks like the linkedByQuery subquery provided by that app might be better able to give you back the results I think you are looking for here.

Andy

michael sam May 14, 2020

Andy,

I really appreciate the feedback and I think your right because I've tried many different JQL query

New question actually advice needed, I've been playing with Jira for over 1 year now I am getting better but there is a lot to jira.

I have never been formerly trained its been kind of reading things and applying.

I want to build a more solid jira knowledge base and I want to certify in the 600 series any suggestions?

Will the course offered by atlassain be good start to getting a solid foundation or do you have other recommendations?

Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 18, 2020

Hi Michael,

It might be better to ask over in our Training & Certification collection. I have to admit that I don't have any experience with that particular level of certification so I really don't know what it entails exactly.

Andy

0 votes
Deleted user July 15, 2019

Is there a way to do this without Scriptrunner in Jira 8+?

There is the new feature of "issueLinkType", but this would not check the status of the linked issues.

Jared Beach January 26, 2021

The only way I can figure out to do this without extensions is to make one filter to find the blocked issues

ex: issueLinkType in ("is blocked by")

 

and then another filter that references the previous one to find not blocked issues:

filter not in ("filter1")

Suggest an answer

Log in or Sign up to answer