I have a workflow that creates 5 different subtasks via different transitions. I have a global 'Cancel' transition to close the task on the parent workflow and all sub-task worflows.
I have this built-in code from Adaptavist:
import com.atlassian.jira.component.ComponentAccessor
def issueService = ComponentAccessor.getIssueService()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def subTasks = issue.getSubTaskObjects()
subTasks.each {
if (it.statusObject.name == "Closed") {
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
setResolutionId(10301) // resolution of "Fixed"
setComment("*Resolving* as a result of the *Resolve* action being applied to the parent.")
setSkipScreenCheck(true)
}
// validate and transition subtask
def validationResult = issueService.validateTransition(null, 10317, 41, issueInputParameters)
if (validationResult.isValid()) {
def issueResult = issueService.transition(user, validationResult)
if (!issueResult.isValid()) {
log.warn("Failed to transition subtask ${it.key}, errors: ${issueResult.errorCollection}")
}
} else {
log.warn("Could not transition subtask ${it.key}, errors: ${validationResult.errorCollection}")
}
}
}
When I test it, nothing is working, and the logs in the post function say that there are no problems. I have searched the internet and the community questions high and low for an answer but have had no luck.
Please may someone help me with what values I need to enter and where, and if this will close all my subtasks or if i need to copy certain bits of code and reuse them for different subtasks