Skip to end of banner
Go to start of banner

Block `Close` Transition Until All Subtasks are Closed

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 25 Next »

Block `Close` Transition Until All Subtasks are Closed


Required apps

 You will need the following Jira apps:

  1. Power Scripts for Jira

Level: BASIC


Problem

We want to block the task 'Close' transition if there are subtasks which are not closed. To accomplish that we need to add a new condition to the 'Close' transition.

Solution

Adding a new condition

Log in as an administrator and navigate to Administration-> Workflows and edit "Close Issue" transition on the default JIRA workflow. Press `Add` a new condition:

Now add a '(k) SIL condition':

The following screen appears:

Writing code

The following code (also shown above) does all the magic:

//blocks `Close` transition on parent task
//until all its subtasks are closed
for (string sk in subtasks(key)) {     

    //if found subtask that has not been closed, return false     
    if (%sk%.status != "Closed") {         
        return false;     
    } 
}  

//otherwise return true 
return true;

Press the 'Save' button to save it on the server side (you can also check its syntax before, use the 'Check' button in the editor's menu).

Info

All you have to do now is to publish your workflow.
See more at Activating Workflow section on Atlassian Documentation

  • No labels