I'm trying to write a query to show me tickets with completed dependencies. I think I should be able to do this with scriptrunner.
Basically, show me all tickets in this project that are not closed that have a link of type "depends on" where the linked card is in status "completed" or "ready for testing".
I did see this post: https://community.atlassian.com/forums/Jira-questions/Find-Issues-where-all-quot-Depends-On-quot-issues-are-Done/qaq-p/2248148
However that query takes a *very* long time to run and does not return any results for me.
Hello @C-Benjamin.Tomb
Welcome to the Atlassian community.
TL;DR - jump to the end of this reply.
I don't believe that the query provided by @Benjamin will meet your requirements.
Your requires are:
1. Issue in a specific project that are not Closed
2. where the issue has 1..n linked issues using the "depends on" link type
3. where all the "depends on" linked issues in status "completed" or "ready for testing".
Benjamin's answer will get you
- all issues linked to an issue that has a status other than Closed
It doesn't take into consideration the link type or the status, which is one of your requirements.
The query you found in the other post takes a long time because it has to resolve three levels of filtering that are each essentially trying to look at every issue in your instance to see if they match each level of the filter.
1. Innermost filter level:
statusCategory = Done
That searches through all the issues on your system
2. Next level outward:
- the issues linked to level 1 by "relates to"
3. Next level outward
- the issues linked to the results from level 2, with no constraint on where those may exist, so again potentially searching a large number of issues.
Let's break down your requirements:
1. Issue in a specific project that are not Closed
That starts with this:
project = X and status != Closed
2. where the issue has 1..n linked issues using the "depends on" link type
For that portion you could use:
issueFunction in hasLinks("depends on")
So far we have
project = X and status != Closed and issueFunction in hasLinks("depends on")
3. where all the "depends on" linked issues in status "completed" or "ready for testing".
This is where it gets more complicated.
The issue from project X could have multiple "depends on" links. Some of the linked may be in the specified statuses, while others of the linked issues are unacceptable statuses.
There is no single ScriptRunner function available to handle this case and get you only the Project X issues where the "depends on" linked issues are all in the desired status.
A solution is to create a filter to exclude the Project X issues where the linked issues are in the undesirable status.
issueFunction not in linkedIssuesOf("status not in (completed,'ready for testing')", "depended on by")
The problem with this query is that it has to first collect the issues that satisfy the subquery of the linkedIssuesOf() function which is
status not in (completed, 'ready for testing') and issuefunction in haslinks("depended on by")
With no constraint in there for Project or issue type, that subquery is going to look at all the issues in the system to find the ones that match the criteria.
So, is it possible to constrain the subquery to search a smaller set of projects for linked issues?
Without constraining that further you final query looks like this:
project = X and status != Closed and issueFunction in hasLinks("depends on") and
issueFunction not inlinkedIssuesOf("status not in (completed,'ready for testing')", "depended on by")
And this query could definitely take a long time to run.
Welcome. Maybe it can be simplified as so in JQL:
issue in linkedIssuesOf("status!=Closed")
You can replaced whatever status you like that meets your needs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.