Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Section


Column
width600px


Panel
borderColor#333f48
bgColor#FFFFFF
titleColor#eeeeee
borderWidth1
titleBGColor#333f48
borderStylesolid
titleOn this page

Table of Contents
maxLevel1



Column




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
pageCondition and validation on sub-tasks
labelsexample



Boolean condition and validator with math. date-time or text-string terms

Incoming Links
pageBoolean condition and validator with math. date-time or text-string terms
labelsexample



Copy parsed text to a field

Incoming Links
pageCopy parsed text to a field
labelsexample



Related Usage Examples

Content by Label
showSpacefalse
cqllabel = "example" and label in ("transition","sub-task")


Incoming Links
pageBoolean condition and validator with math. date-time or text-string terms