Is it possible to pass the current issue into the Script Runner JQL condition?
What I'd like to do is check the status of all subtasks of parent of the current issue and if they're all status X, prevent the transition from being displayed.
Hi Trevor,
What you want to achieve is best done by workflow conditions in combination with the script runner plugin.
That's what I'm trying to do... use the JQL Condition from the script runner plugin. The condition I'm hoping to implment is a check that all other subtasks aren't in status X before displaying a specific transition button.
This is how the condition script should look like:
for(subTask in issue.getSubTaskObjects) { if(subTask.isSubTask() && subTask.statusObject?.name == 'Your status') { return false; } } return true;
When one subTask has the status, the script returns false and the condition evaluates to false and the transition button will not be visible. When no subtask has the status, the script will return true and the condition evaluates to true and the transition button is visible. As you can see there is no need to use JQL here.
I haven't tested the script, so it could contain some syntax errors
Hope this helps?!
P.S: Do you know how to manipulate workflows and add post-functions?
I may be mis-reading, but this would be applied to the parent task... what I want to do is have a condition on one of the subtasks based on the status of all of the other subtasks of the same parent...
And yes, I'm very familiar with post-functions and workflows, but I'm more of a hack when it comes to writing the groovy code, I'm afraid. I can read it well enough to modify and extend functionality, but writing from scratch is something I need to work on.
I know you have a solution now, but the answer to your question as written is "unfortunately not".
It would be complicated than that because the UI would need to allow "any match", "no matches" etc.
Also as you are looking at "siblings", you would need to have a parentsOf and childrenOf in your jql query, and Benji's method is clearer.
It looks like you're new here. Sign in or register to get started.