Page History
Section | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Features used to implement the example
- Condition and validation on sub-tasks
- Boolean condition and validator with math. date-time or text-string terms
- Copy parsed text to a field
Example: Close parent issue when all sub-tasks are closed
We want to automatically close parent issue when the all subtasks has been closed. We are going to describe two different solutions to implement this behavior
This solution consist on a validator in parent's workflow, and a post-function in sub-tasks workflow:
A validation in parent issue workflow to prevent parent issue from being closed manually whenever there still are open sub-tasks. To do it we use Condition and validation on sub-tasks in transition "Done" or "Close Issue" on parent's workflow with the following configuration:
Once configured, transition "Close Issue" in sub-taskparent's workflow will look like this:
Alternatively, we can use Boolean condition and validator with math. date-time or text-string terms with the following boolean expression:
count(subtasks()) = count(filterByStatus(subtasks(), "Closed, Done"))
We add a post-function in sub-task's workflow for trying to close parent issue each time a sub-task is closed. To implement it we use post-function Copy parsed text to a field in transition "Done" or "Close Issue" on sub-task's workflow with the following configuration:
Once configured, transition "Done" or "Close Issue" in sub-task's workflow will look like this:
Note: If you are using Jira 7.0 or higher with versions of Jira Workflow Toolbox older than 2.2.8, you should input the following boolean expression in parameter Conditional execution:
count(filterByStatus(siblingSubtasks(), "Closed, Done")) = count(siblingSubtasks())
This way we are preventing transition from being executed whenever the validation is not satisfied.
Alternative implementation
Using only a post-function in sub-tasks workflow, the other implementation is usually preferred since it also prevents parent issue from being closed until all sub-tasks are closed, even if you try to do it by manually triggering transition "Done" or "Close Issue". Anyway, sometimes you may want to allow manually overriding parent closing, even if there still are open sub-tasks.
This solution uses a post-function Copy parsed text to a field in transition "Done" or "Close Issue" in sub-task's workflow with the following configuration:
Conditional execution: count(subtasks()) = count(filterByStatus(subtasks(), "Closed, Done"))
Once configured, transition "Close Issue" in sub-task's workflow will look like this:
Other examples of that functions
Condition and validation on sub-tasks
Incoming Links | ||||
---|---|---|---|---|
| ||||
Boolean condition and validator with math. date-time or text-string terms
Incoming Links | ||||
---|---|---|---|---|
| ||||
Incoming Links | ||||
---|---|---|---|---|
| ||||
Related Usage Examples
Content by Label | ||||
---|---|---|---|---|
|
Incoming Links | ||
---|---|---|
| ||