I'm trying to write a condition where all subtasks in an issue needs to be in done or canceled state, only then clone the issue. However, the for loop is not checking each element of the collection just the first one. I tried quite a few variations of the for loops yet the result is the same.
The condition should fail if there are any other status for the same issue type.
This is the script:
Collection subTasks = issue.getParentObject().getSubTaskObjects()
for(subTask in subTasks)
{ if (issue.issueType.name == "<issue type name>" && (issue.status?.name == 'Done' || issue.status?.name == 'Canceled')){
return true
} }