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.issueType.name == "QA" && !it.resolution) {
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 }
Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.
Ask a question about ScriptRunner for JIRA, Bitbucket Server, or Confluence.
Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.