change WF state after all subtask are closed

peter novak
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 13, 2012

hi there

i am creating subtask automatically in transition (transition "Error occured" creates subtask) ....

i would like to automatically change state from "Error" to "in progress" after all subtask are closed ... now i have a transition "bugs resolved" with subtask blocking permission ... is it possible to make it automatically?

thank you

3 answers

1 accepted

0 votes
Answer accepted
peter novak
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.
October 9, 2012

i have solved this problem with

Script Runner (https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner)

this plugins has build in example:

  • Auto-transition parent when all sub-tasks are resolved

I add this post script function to "Close" transition on subtask (in IE i cannot add this function, try it in Firefox ;) ) and it works nice :) (subtsask must have resolution!)

enjoy

1 vote
John Knight August 13, 2012

Its definitely possible, but its a little tricky: your best bet is to write a EventListener that listens for a particular event type that you throw during the transition of the subtask (for instance, the Close Issue event). Basically, when the subtask is marked as Closed, the Close Issue event is fired, the EventListener picks it up and can do some basic checking, such as:

* is the issue that fired the event the issue type I care about

* does the issue that fired the event have a valid parent issue to auto-transition

* are all the other subtasks on that parent closed

=> then, transition the parent issue.

The biggest problem here is that the listener will pick up _all_ Close Issue events, so you'd want to short circuit that down as fast as possible, as above, or depending on your expected volume, potentially even write your own Event type.

Hope that helps.

John

peter novak
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 13, 2012

thank you for advice.

but please, can you be more specific? some code examples with places to save the code? :)

Listener can be added in System - Advanced - Listeners. but i would need template codes ... thx

0 votes
David Toussaint [Communardo]
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 13, 2012

Hi Peter,

as far as I know automating transitions is not possible with any plugin available or even out of the (JIRA) box. You can however use one of the scripting plugins to and write a custom script which would do the job for you.

Anyway be advised that by doing so, this may easily can result in inconsitent dtat in your database as you have to allways keep the status and the according workflow step in sync. Also automating your workflow as described is possible you may wish to question the backgroud/use case of this sollution. Apart form inconsistent data there is always a chance of misconfiguration which may block your workflow on some point.

Regards, David

David Toussaint [Communardo]
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 13, 2012

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events