Hello,
I've found some helpful code in the Community that allows for a specific sub-task to be open and still allow for a transition to complete, and am trying to modify it to check if other sub-tasks have either a null resolution or not a Status "Done" or "Canceled," and if so, block the transition.
The code works fine if I only include the status check for "Done," but if I try to check for "Canceled" too, it's not working. I thought it would be correct to put the status check in an OR contained in parenthesis, but I think this is causing the issue, and I'm not very good at coding, so I'm unsure on how to proceed.
Any assistance would be greatly appreciated!
(it.getStatus().name != "Done" || it.getStatus().name != "Canceled")
import com.opensymphony.workflow.InvalidInputException
def passesCondition = true
def subTasks = issue.getSubTaskObjects()
def subBoolean = issue.subTask
//If the issue is not a subtask and contains subtasks
if(!subBoolean && subTasks){
subTasks.each { //Loop each subtask of parent issue
//If the subtask is "System Build"
if (it.summary == "System Build") {
passesCondition = true
}else{ //Else if the subtask is not "System Build"
//If the subtask has null resolution or not a Status "Done" or "Canceled"
if(!it.getResolution() || (it.getStatus().name != "Done" || it.getStatus().name != "Canceled")){
passesCondition = false
//Block the transition
throw new InvalidInputException("subTask","Not all substasks ($it) are closed as 'Done'!")
}else{
passesCondition = true
}
}
}
}else{
return true
}