automatic transition on parent issue when all sub-tasks are closed

Hi there,

following situation:

  • an Issue is create manually
  • on a transition several ( curently 5) sub-tasks are created by plugin ( JIRA Create on Transition Plugin )

What I now want is, that when all sub-tasks are closed, the next transition step on the parent task is executed.

How can this be done?
Thanks for Helping.
Jörg

4 answers

1 accepted

This widget could not be displayed.

If you have workflow extensions installed you don't need to write any code at all - just use the transition parent post function on the close step of the sub-task workflow using the id of the transition from the parent workflow you want (transition id, not step name/id). Set the conditions as needed on the parent workflow transitions to prevent it from transitioning when you don't want, and you should be good to go.

Oh, and make sure that you move the post functions for transitioning parent in the sub-task workflow to the BOTTOM of the post function events list; if you leave them at the top where it places them after you have added them it won't work.

Oh, and make sure that you move the post functions for transitioning parent in the sub-task workflow to the BOTTOM of the post function events list; if you leave them at the top where it places them after you have added them it won't work.

That was the important information.

Moving the post function to bottom and everyting works as I want.

Many thanks

Nat

Awesome, I'm so glad that worked! I've run into the same problem several times myself so that is now one of the first things I check. :)

Many thanks...

I think I will never forget this in future...
It's logical overall but sometimes admin/developers are to blind ;)

Hi Nat,

thank you very much for your tipps. I had so much problems to get this working. Now it works very well. :)

Thanks @Natalie Hobson , I had the same requirement and your solution worked for me !  smile

Move to BOTTOM ... that solved it! *doh* Thank you very much!

@Atlassian isn't that a bug?

This widget could not be displayed.

You need to do this in the post function. You can have a simple script that checks if all subtasks are closed and then pushes the parent task in the relevent transition. You might event be able to make it simpler by just throwing an event when the condition is satisfied and use Auto Tranisiotn Listener in JIRA Toolkit to do the transition.

If you are okay to do manual transitions but make it visible only when all subtasks are closed, it is even simpler. Just use the subtask blocking condition.

Hi Jobin,

I have now found the condition "subtask blocking" and the plugin "JIRA Misc Workflow Extensions" provides the post function "Transition Parent Issue".

The single parts working now, but not when all meets togeter.

So: Transition is fired by sub-task when "subtask blocking" condition is disabled

But when the condition is enabled, closeing all subtask doens't fire the transition.
I'm going to make a bug report for the plugin because of this.

I will also check out "auto transition listener", thanks

Jörg

I have now configured the auto transition listener but thats not working.

It's trying to execut the action on the sub-task workflow and not on the parent workflow.
Ans yes, I have entered the correct action id.

I think you didn't get my answer fully. You need something written by yourself to either push the parent issue or throw an event on the parent issue (along with Auto Transition listener on parent issue's workflow) when the subtasks are all resolved.

Subtasks blocking condition can only show/hide the transition on parent issue based on its subtasks status.

The listener gets the event, I let be fired by the sub-task close transition.

But the auto listener tries to execute the action on the sub-task workflow (where this action Id is not available) and not on the parent task workflow (where the action Id is available).

And yes, the action ID was mentioned correctly.

The problem is, event is fired on subtask and the listener will hence attempt the transition on subtask. You need to fire the event on parent task to get auto transition listener working. You need a plugin or some scripting to do this.

This widget could not be displayed.
In JJupin, all you have to do is to register this on the postfunction of the subtas. Example is not tested, transitions names may not be correct, but you will get the idea:
===========
string sk;
bool allclosed = true;
//we should have here a do - while, but this will work for the sake of the example
for (sk in subtasks(parent.key)) {
if (%sk%.status != "Closed" && sk != key) {
allclosed = false;
}
}
if(allclosed) {
autotransition("Close", parent.key);
}
===========
[Unfortunately,] this is a commercial plugin. You can implement the same logic using a free scripting plugin.

Hey Radu,
sounds interesting...
I will try it with Jira Scripting Suite.
Thanks

Jörg

This widget could not be displayed.
Andreas Knecht Community Champion Nov 21, 2016

There's now a very easy to configure way to transition parents and sub-tasks in sync using Automation for JIRA!

You can easily modify related issues (such as parents, stories, sub-tasks, epics, linked issues and even JQL) using our related issues action and condition:

(this example transitions sub-tasks, but you could just as easily change this to transition the parent as a result of a sub-task being transitioned)

You could configure a rule that simply checks if all sub-tasks are closed and then transition the parent to a given step using the related issues action.

For more details see https://blog.codebarrel.io/synchronize-parent-and-sub-task-issues-with-automation-for-jira-bdcca6c9d453

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

90 views 13 7
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