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 :(
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
would that make sense? :-D
maybe i should try the custom listener instead...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alexander Richter hi again... I knew that , there is something like you wanted!
How about this: 1.
2.
As it says.. it will close the parent issue when all the subtasks are resolved.
regards
CM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.