we are using scriptrunner and I am a newbie to jira expressions. I have been trying to figure out how to restrict the transition using Validators for a specific issue sub-task type.
I would like all "defect sub-tasks" to close prior to moving to the next status.
I started with the example from adaptivist which works:
issue.subtasks.filter(subtask => subtask.status.name != 'Done').length == 0
but I don't know how to modify it so that both status AND issue type are being checked. the parent issue can have other normal sub-tasks that are not of type "defect"
issue.subtasks.filter(subtask => subtask.issuetype.name == 'Defect' && subtask.status.name != 'Done').length == 0
The error I get goes like this:
FALSE
An error occurred. Anything other than a true result is considered false, so the transition would not be allowed.
View Results
Evaluation failed: "subtask.issuetype" - Unrecognized property of `subtask`: "issuetype" ('issuetype'). Available properties of type 'Issue' are: 'assignee', 'attachments', 'changelogs', 'closedSprints', 'color', 'com.herocoders.plugins.jira.issuechecklist-free__checklist-text-view-only', 'com.herocoders.plugins.jira.issuechecklist-free__issue-checklist-progress-field', 'com.herocoders.plugins.jira.issuechecklist-free__issue-checklist-progress-percent-field',.... yada yada yada
I have been unsuccessful in trying to find any tutorials for beginners. 