All Sub-tasks Resolved Condition
All QA Sub-tasks resolved
This condition verifies that all sub-tasks of a certain issue type, in this case QA, must be resolved in order for the transition to be allowed.
There is a built-in script All sub-tasks resolved, but if we want to tweak it such that we only care about certain sub-task types, or components, or assignees or whatever, we need to write it ourselves. Which is pretty easy.
passesCondition = true
def subTasks = issue.getSubTaskObjects()
subTasks.each {
if (it.issueType.name == "QA" && !it.resolution) {
passesCondition = false
}
}
All Sub-tasks assigned to me
Similarly, a condition to check that all sub-tasks are assigned to the current user:
import com.opensymphony.workflow.WorkflowContext
def subTasks = issue.getSubTaskObjects()
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller()
passesCondition = subTasks.every { it.assigneeId == currentUser }