Hi All,
I am looking for a scriplet to put in the workflow of a subtask :
There are 2 kinds of subtasks in my project ( X and Y)
In my Jira issue, there are 4 subtasks ( 2 of Type X and 2 of Type Y)
If all subtasks of Type X are Closed then parent should be moved to next stage. I am putting this condition in the workflow of Subtask of Type X, using the below condition, but it is not working:
issue.parentObject.subTaskObjects.findAll{it.issueTypeObject.name ="XXX"}.each{it.resolutionObject.name == "Closed"}
The parent transition occurs even if I close a single subtask of Type XXX, while I want this check to be performed for all subtasks of Type XXX.
Because you did not write any condition in your code...
it's just code that do nothing, that is why the transition happens even if only 1 subtasks is closed (and not all)
Use this:
def parent = issue.getParentObject()
def subtasks = parent.getSubTaskObjects()
def allSubtasksClosed = true;
for (def i = 0; i<subtasks.size(); i++) {
if (subtasks.getAt(i).issueTypeObject.name == "XXX") {
if (subtasks.getAt(i).getStatusObject().name != "Closed") {
allSubtasksClosed = false;
}
}
}
/*eventually if true (all subtasks of type xxx are closed) the parent will transition*/
return allSubtasksClosed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.