All Subtasks Resolved
All QA Sub-tasks resolved
This condition verifies that all subtasks 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 subtasks resolved, but if we want to tweak it such that we only care about certain subtask 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.issueTypeObject.name == "QA" && ! it.resolutionObject)
passesCondition = false
}
All Sub-tasks assigned to me
Similarly, a condition to check that all subtasks 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 }
For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.
Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.