Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Fast-track transition - Condition on Subtasks

Alexander Richter
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.
May 8, 2019

I'm using the Scriptrunner - Fast-track transition function in one of my workflow transition. The function should only fire , if all subtasks are resolved.

Can somebody give me a hint how the code should look like?

i searched a bit for myself and had following solution

def subTasks = issue.getSubTaskObjects()

subTasks.each {
if(!issue.getResolution()){
false
}
}

But the function will fire nevertheless :(

1 answer

0 votes
Christos Moysiadis
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.
May 8, 2019 edited
def subTasks = issue.getSubTaskObjects()

def countResolved = 0;
subTasks.each { sb ->
if(sb.getResolution() == "Resolved"){
countResolved++
}
}
if(countResolved == subTasks.size()){
return true;
}
return false;

Something like this? I have not tested it.... sorry if there are any errors

PS: i'm sure there is a better solution too. 

Alexander Richter
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.
May 8, 2019

Hi Christos,

there are no errors in it ;-)

But with your code the function is not firing at all. Though all subtasks are resolved, the transition is not happening.

Christos Moysiadis
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.
May 8, 2019 edited

maybe because they are all already resolved ?! 

I have not used this fast transition option to tell you the truth. We use a custom listener for some specific automatic transitions

Alexander Richter
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.
May 8, 2019

would that make sense? :-D

maybe i should try the custom listener instead...

Christos Moysiadis
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.
May 8, 2019 edited

For some reason i am sure that it should work @Alexander Richter :D ... maybe the post function (fast transition) is in wrong transition step, between status A and B, while it should be inbetween C & D etc.

Did you check these details? Sometimes the solution is in front of our eyes and we doesn't see it!

Like • Alexander Richter likes this
Alexander Richter
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.
May 8, 2019

@Christos Moysiadis  i am sure it is somewhere in the details :-)

but it is not about the transition, this one works.. when i leave the condition blank it will Transition the issue as i want it to do. It has to be the condition.

At first i tried to go for the status with following code:

def subTasks = issue.getSubTaskObjects()

subTasks.each {
issue.getStatus().getName() == 'Active User'
}

what it does is that the issue will be transitioned if one of the subtasks has the right status. If all other subtaks do not have the right status the function will fire nevertheless.

So i am not really convinced that subTasks.each{} is doing what it should do... on the other hand i am a scripting noob and maybe just think wrong :D


just right now i changed your code from == "Resolved" to != "Unresolved" .. Now the function will again fire every time instead of not at all :D

Christos Moysiadis
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.
May 10, 2019 edited

@Alexander Richter hi again... I knew that , there is something like you wanted!

How about this: 1. test1.png  2. test2.png test2.png

As it says.. it will close the parent issue when all the subtasks are resolved.

regards

CM

Alexander Richter
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.
May 13, 2019

Hi @Christos Moysiadis , thanks for sharing but that won't help in my case.. :-(

using the postfunction you mentioned above, the parent issue will be transitioned as soon as the last subtask is resolved.

I need the condition to be checked while transitioning the parent task from step A to step B. if it evaluates to true step B shall be skipped.

So fast track transition would be exactly what i need, if i got the condition running...

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events