Find linked issues recursively without epic links

I have a story ABC-123, which is linked to other stories and bugs and they are also linked to other stories and bugs.

I want to get all linked issues recursively with all kinds of links, except for Epic Link (I don't want to get the epic of ABC-123) and except for sub-tasks (I don't want to include sub-tasks of ABC-123 or sub-tasks of A's linked issues)

I am using Adaptavist ScriptRunner and my first naive attempt was 

issueFunction in linkedIssuesOfRecursive("issue = ABC-123")

However ABC-123 is part of epic ABC-456 and this epic has dozens of stories inside it and as result I get 4000 issues

I compared this with JQL Tricks plugin (using linkedAllIssues("ABC-123")) and it returned 29 issues (which is correct from my definition)

Seems like JQL Tricks did not consider the epic as "linked issue" and did not "explode" that part of the tree.

I know that with ScriptRunner I can limit the list of linked issues by link type, but we have so many link types, that I don't want to write something like 

issueFunction in linkedIssuesOfRecursive("issue = ABC-123","blocks")
 OR issueFunction in linkedIssuesOfRecursive("issue = ABC-123", "is blocked by") 
 OR issueFunction in linkedIssuesOfRecursive("issue = ABC-123", "duplicates")
 OR issueFunction in linkedIssuesOfRecursive("issue = ABC-123", "is duplicated by")

etc.

 

Is there a way to instruct ScriptRunner to not follow specific type of links in that function?

Many thanks in advance.

 

P.S. Having both ScriptRunner and JQLT is out of question, due to cost restrictions

1 answer

1 accepted

Hi Pavel,

This was a known issue with ScriptRunner for JIRA, and was resolved in version 4.3.15 as per https://productsupport.adaptavist.com/browse/SRJIRA-1329.  Following this, additional tools (the linkedIssuesOfAll* functions) were provided in 4.3.16 to provide the functionality that the linkedIssuesOf* functions provided prior to 4.3.15, as per https://productsupport.adaptavist.com/browse/SRJIRA-2146.

With this in mind, I would strongly recommend upgrading ScriptRunner to version 4.3.16 in your instance (which is compatible with JIRA 7.0.0 to 7.3.1), but please bear in mind the impact of the changes mentioned above in the contexts of other queries you may have in your system.

If you are unable to upgrade your version of ScriptRunner, the example you wrote above will unfortunately not work as it will navigate each chain separately:

Imagine a simple example where ABC-1 blocks ABC-2, which itself duplicates ABC-3, doing linkedIssuesOfRecursive("issue=ABC-1","blocks") will give us ABC-2 but not ABC-3, and linkedIssuesOfRecursive("issue=ABC-1","duplicates") will return neither ABC-2 nor ABC-3.

In this case, if you aren't able to upgrade ScriptRunner, you will either have to construct a custom JQL function (documentation can be found here, but bear in mind it will be effectively deprecated upon upgrade when a built-in function exists), or utilise JQL-Tricks.

Kind regards,

Jamie Sawyer

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

475 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you