Automatically transition issue when all linked issues are resolved?

We want to setup a post-function that resolves an issue when linked issues are resolved (if there are linked issues to the issue). So as an example, if "is blocking" issues are resolved, it will automatically resolve "is blocked by" issues.

Looking at Scriptrunner's "Fast-track transition an issue" but unsure of the condition to use. Or open to other solutions (maybe a Bob Swift solution?)

1 answer

1 accepted

I assume you are looking at the documentation at https://scriptrunner.adaptavist.com/latest/jira/builtin-scripts.html#_fast_track_transition_an_issue which includes how to transition a parent issue when all linked tasks are closed. The example provided in here showing auto closure refers to subtasks and the entry needs to go on the workflow of the subtask to trigger the check and potential closure. 

If however, you are looking at any linked issues I assume that you have a business case similar to this...

All related issues are linked together and when one is resolved then all such issues should be resolved automatically.

For this you should probably check the link is of a specific type and again the post-function would go on the closure transition in the workflow applying to each issue.

Without checking your link type you risk closing all issues regardless of whether they meet your business case or not.

Perhaps you could confirm in more detail the business case you are trying to solve?

I have a similar case.  We have a project that has a specific issue type that when created automatically generates a series of tickets in other projects.  Once all the linked issues are resolved we would like the original ticket to be resolved.  I have tried to use the "Fast Track transition" script runner listener, but I am having issues with setting up the condition?  So far I have the below. 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink

def linkType = ["created"]

def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    if (linkType.contains(link.issueLinkType.name)) {
        if (! link.sourceObject.resolutionId) {
            passesCondition = false
        }
    }

}

 

One of the problems is that this condition would require a trigger from the main ticket.  What I actually need is a rule that would run on each of the linked issues that would check the other linked issues to see if the others are already resolved and if so it would automatically close the main ticket without needing any interaction from the user.

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...

184 views 1 17
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