Hi Team,
In project I have 4 different sub-tasks. Is there a way to close all subtasks when the parent Issue is closed ?Native solution, Plugin or Groovy script ?If yes, could you please provide the achieved code.
Thanks,
Phani
Hi @Mohamed Benziane so I used the one query in that I just want know the sub-task I'd Where exactly I can find the Sub-task id so I have an 5 subtasks in my project here is query can tell me the what else I can make changes in that query
Can please help me
Thanks,
Phani
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 == "Open") {
def issueInputParameters = issueService.newIssueInputParameters()
issueInputParameters.with {
setResolutionId("10000") // 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(user, it.id, 5, 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}")
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Kumar
Sorry i'm not a scriptrunner expert but if you want to retrieve an issueID i think this will help
getUnderlyingIssue()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.