ScriptRunner enhanced search - advanced blockers search

Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 3, 2019

We're looking for a way to easily view blockers and blocked issues in our boards. I was able to set up two saved filters using enhanced search, one using "blocks" and one using "blocked by":

issueFunction in linkedIssuesOf("project = DE", "blocks")

issueFunction in linkedIssuesOf("project = DE", "is blocked by")

 

The problem I'm running into is this: I get back the correct list of issues that are blocked by others, but when I open one of them, I can see that although the link is still in place, the issue that's marked as the blocker is closed (resolved), so technically it's no longer a blocker.

I'd love to just tell our users that they need to be responsible for updating links, but with the volume of issues we track, that's not feasible.

Is there any way to update the query to only return issues whose "blocked by" tickets are unresolved?

We are on Cloud; I know that there are some differences in ScriptRunner, so please keep that in mind when providing an answer.

1 answer

1 accepted

0 votes
Answer accepted
Peter-Dave Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2019

Yeah, like this:

issueFunction in linkedIssuesOf("projects = DE and resolution is empty", "blocks")

Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 5, 2019

Thanks. I didn't realize I could use more complex JQL than just the project name in the linkedIssuesOf params.

Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 10, 2019

OK, I marked this as accepted, and it seemed to work for one project's set of searches. I just tried to create a new set for a different project, though, and it's not quite working correctly.

I would expect that using status != Closed in the search would return only issues where the status isn't Closed (we can't use Resolution, as Closed is not our final status, so the resolution is not set at that point.) That clearly isn't the case, though, as you can see from this screenshot. 

Is there anything obvious I'm doing wrong here, or is it a bug in the plugin? Or is resolution really the only bit of JQL that can be used in linkedIssuesOf?

statusClosed.png

Peter-Dave Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2019

This inner query applies only to the linked issues.

This says "give me all issues that are linked to open issues in the PHTP projects with the "blocks" link type.

If you want to exclude non-closed issues in the final list, you need to add a "and status != closed" outside of the issue query.

so perhaps:

status !=closed and issueFunction in linkedIssuesOf("project = PHTP and status != closed", "blocks")
Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 10, 2019

So let me explain what I'm trying to do.

Say I have two tickets, PHTP-10 and PHTP-22. They are linked; PHTP-10 blocks PHTP-22:
blocker.pngblockedBy.png

We're trying to create quick filters in boards that will allow a project manager to display only tickets that are blockers and only tickets that are blocked. However, our volume is too high for them to update the links on every ticket when the status changes. So because PHTP-10 is Closed, even though the ticket link still indicates that PHTP-22 is blocked by PHTP-10, it's not really blocked anymore.

What I want is to build two queries:

1) Show me all tickets are blocked. Since the query doesn't allow me to search for actual issues that are blocked, I need to find all tickets that have linked issues whose link type is Blocks.

2) Show me all tickets that block other tickets. Again, since I can't search for tickets that have links, I'm assuming I need to search for linkedIssuesOf where the linked issues are of type "is blocked by".

When a user clicks a quick filter that's supposed to show blockers, they don't want to see tickets that are already closed, because those tickets, while they may be linked as Blocks, are no longer blocking the linked issue. And inversely, when they click a Blocked quick filter, they don't want to see issues that have links indicating Blocked when the linked tickets are closed, because that means the ticket is not actually blocked anymore.

 

Make sense?

Peter-Dave Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 10, 2019

Yeah, you'll want 2 quickfilters for that.

Blocked issues:

issueFunction in linkedIssuesOf("project = PHTP and status != Closed", "blocks") and status != Closed

Blocking Issues:

issueFunction in linkedIssuesOf("project = PHTP and status != Closed", "is blocked by") and status != Closed

This assumes that an issue is no longer blocked or blocking if it is closed

E.g.

A Block B
A Block C
B Blocks D

When all 3 are open,

  1. filter 1 (blocked) returns B, C D
  2. filter 2 (blocking) returns A and B

If A is closed:

  1. D (A no longer blocks C and B)
  2. B (A is no longer blocking since it's closed)

If B is closed: 

  1. C,D -- B is not blocked if it could be closed
  2. A -- B is not blocking D anymore since it's closed

If C is closed:

  1. B,D
  2. A,D (A still blocks B)

If D is closed

  1. B,C (both still blocked by A)
  2. A (B no longer blocks D)
Esther Strom
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 11, 2019

Yes, thank you! 

Suggest an answer

Log in or Sign up to answer