Date: Fri, 29 Mar 2024 02:20:37 +0100 (CET) Message-ID: <698616084.466.1711675237679@apps-confluence-5.apps-confluence.apps.svc.cluster.local> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_465_1435071937.1711675237679" ------=_Part_465_1435071937.1711675237679 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
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-fu=
nction in sub-tasks workflow:
A validation in parent issue workflow to=
prevent parent issue from being closed manually whenever there still are o=
pen 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 parent's w= orkflow will look like this:
Alternatively, we can use Boolean condit= ion and validator with math. date-time or text-string terms&nb= sp;with the following boolean expression:
count(subtasks()) =3D count(filterByStatus(subtasks(), "Cl=
osed, Done"))
We add a post-function in sub-task's workflow= strong> 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 trans= ition "Done" or "Close Issue" on = sub-task's workflow with the following configuration:
Once configured, transition "Done" or "Close Is= sue" in sub-task's workflow will look like this:
Note: If you are using Jira 7.0 or higher<= /strong> with versions of Jira Workflow Toolbox<= /strong> older than 2.2.8, you should input the following boolean expressio= n in parameter Conditional execution:
count(filterByStatus(siblingSubtasks(), "Closed, Done")) =
=3D count(siblingSubtasks())
This way we are preventing transition from being executed whenever the v= alidation is not satisfied.
Using only a post-function in sub-tasks workflow, the other implementati= on is usually preferred since it also prevents parent issue from being clos= ed until all sub-tasks are closed, even if you try to do it by manually tri= ggering transition "Done" or "Close Issue= ". Anyway, sometimes you may want to allow manually overriding parent closi= ng, even if there still are open sub-tasks.
This solution uses a post-function Copy parsed text to a field in tr=
ansition "Done" or "Close Issue" in
Conditional execution: count(subtasks()) =3D count(filterB=
yStatus(subtasks(), "Closed, Done"))
Once configured, transition "Close Issue" in sub-task's= workflow will look like this:
C= ondition and validation on sub-tasks
Boolean condition and validator with mat= h. date-time or text-string terms