I'm having an issue with Jira Expressions. I'm unclear on how to use if statements.
Goal: I've got an issue type of "Groundwork" that uses a workflow that is standard for all subtasks. When this groundwork status is updated to "Complete", I want to check that all sibling subtasks are assigned (because this is just part of the responsibilities for the person who completes the groundwork task). If any are Unassigned this transition should fail.
Steps Taken:
Problem:
- I'm unsure how to really use functions or if statements in Jira Expressions. I'm getting the following error and I'm unsure how to translate this into Jira Expressions. Error: "Jira expression failed to parse: line 3, column 1:\nexpression expected, reserved keyword 'if' encountered."
passesCondition = true
// if issue is groundwork type
if (issue.issueType.name.match('^(Groundwork)$') != null) {
// get parent
parentIssue = issue.parent
// get subtasks
def subTasks = parentIssue.getSubTaskObjects()
// for each subtask
subTasks.each {
// if not assigned
if (it.assignee == null)
passesCondition = false
}
}
passesCondition
Questions:
1. How can I translate the code above to Jira Expressions?
2. Are there any other alternatives, without Jira Automation?
