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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Trevor,
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's essentially what I want to do:
issueFunction in subtasksOf("issueFunction in parentsOf(\"key = $issue\")") and resolution = Unresolved . . .
Where $issue is the current issue being evaluated.
This returns the issues as expected when run via the Issue Navigator and it evaluates just fine when I manually test it via the console, but just not sure what script runner expects to run this with the current issue as the paremeter for the query.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Trevor,
This script looks at the parent's other subtasks and evaluates based on some subtask's value:
if(issue.isSubTask()) { Issue parent = issue.getParentObject(); for(subTask in parent.getSubTaskObjects) { if(subTask.isSubTask() && subTask.statusObject?.name == 'Your status') { return false; } } return true; } return false;
When the current issue is no sub-task (no parent available), the condition is false directly.
Is this what you are trying to achieve?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Was hoping to use a JQL condition, but this code will accomplish what I'm looking to do:
import com.atlassian.jira.issue.Issue; if(issue.isSubTask()) { Issue parent = issue.getParentObject(); for(subTask in parent.getSubTaskObjects()) { if(subTask.isSubTask() && subTask.statusObject?.name == 'Rejected') { return false; } } return true; } return false;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sharing your solution!
Glad I could help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.