Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Jörg Lang August 7, 2012

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

7 votes
Answer accepted
Natalie Hobson
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.
August 8, 2012

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.

Jörg Lang August 8, 2012

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

Natalie Hobson
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.
August 8, 2012

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

Jörg Lang August 8, 2012

Many thanks...

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

Sebastian Lüdtke November 26, 2012

Hi Nat,

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

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2013
Komail Badami June 10, 2016

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

Florian Grau September 14, 2016

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

@Atlassian isn't that a bug?

0 votes
andreas
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.
November 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

0 votes
Radu Dumitriu
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.
August 7, 2012
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.
Jörg Lang August 7, 2012

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

Jörg

0 votes
Jobin Kuruvilla [Adaptavist]
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.
August 7, 2012

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.

Jörg Lang August 7, 2012

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

Jörg Lang August 7, 2012

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.

Jobin Kuruvilla [Adaptavist]
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.
August 7, 2012

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.

Jörg Lang August 7, 2012

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.

Jobin Kuruvilla [Adaptavist]
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.
August 7, 2012

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.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events