Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Prevent Close of Epic Until All of its Issues are Closed

Diane Durham June 8, 2018

The OOTB template for Software projects allows an Epic to be closed even though there are Issues in the Epic that are not closed.
I want to prevent the closing of an Epic unless all of it's Issues are closed.
There is a "Sub-Task blocking condition" for the Done status has but that doesn't work for Epics.

3 answers

1 accepted

1 vote
Answer accepted
Tessa Tuteleers
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2018

Hi Diane, 

Welcome! 

You are correct, OOTB, no such condition is included. 

But this is a popular use-case and while the problem can be resolved through business rules and training of the users, sometimes a firmer restriction is wanted. 

There are a few possibilities with apps however:

  • JMWE has this option in the UI. It's a neat tool with a low threshold for a lot of extra workflow possibilities.

Screen Shot 2018-06-08 at 16.06.24.png

  • However, if you have ScriptRunner on your instance (as every instance should), and you have someone to script it, that app makes this possible too and gives you even more functionality! 

Hope this helps! 

- Tessa

Sandra Meessen
Contributor
November 22, 2018

Hi Tessa,

What would the coding in Scriptrunner be if I don't have the JMWE add-on available? Could you help me with this one? Requirement: "Close epic only possible when all stories and bugs related are closed". And I would add that coding than as a post-function "Script validator"? 

Thank you for your help. 

Like Renni Verho likes this
Renni Verho
Contributor
February 25, 2019

Something like this may help : 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.link.IssueLinkManager

// Allow logging for debug and tracking purposes
import org.apache.log4j.Level
import org.apache.log4j.Logger

// Script code for easy log identification
String scriptCode = "Check all items resolved -"

// Setup the log and leave a message to show what we're doing
Logger logger = log
//logger.setLevel( Level.ERROR )
logger.setLevel( Level.ALL )
logger.debug( "$scriptCode Triggered by $issue.key" )

passesCondition = true
if (issue.issueType.name == 'Epic')
{
IssueLinkManager issueLinkManager = ComponentAccessor.issueLinkManager
def found = issueLinkManager.getOutwardLinks(issue.id).any{
it?.destinationObject?.getResolution() == null
}
if (found){
logger.debug( "GetResolution empty found" )
passesCondition = false
} else {
logger.debug( "GetResolution no empty found" )
passesCondition = true
}
}
// Always allow all other issue types to execute this transition
else
{
logger.debug( "$scriptCode Not Epic return true" )
passesCondition = true
}

I would add here also link type verification eg. check only "Issues in Epic", but not all linked issues.

Gianluca Fonte March 25, 2021

Hello, I am looking for the same functionality in the Jira Cloud next-gen software project. Can anyone help? Thank you

Like Ivo de Vries likes this
0 votes
Muhammad Moazzam Hassan
Contributor
January 3, 2023

Rather than investing money in the apps, build the logic. 

Create an automation rule on which when all tasks inside epic move to Done or Closed then add the value to custom number field = 1, then add the workflow condition of number field value must be equal to 1.

0 votes
Pete Singleton
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 8, 2018

You can use the Jira Misc Workflow Extensions add-on.  This will allow you to add a validator to the workflow transition, checking the status of Stories within an Epic.

Diane Durham June 11, 2018

Thank you

Diane Durham June 11, 2018

In the Software Basic project type there are no stories.  There are Epics, New Features, Improvements, Bugs, Tasks and Sub-Tasks.  No parent-child links at all except between Tasks and Sub-Tasks and sort of with Epics and all other issue types except sub-tasks.  The team I'm setting this up for does not really want stories or features, they just want tasks and sub-tasks and would like a parent of Tasks in some way. I see with the Basic Software project I can sort of create a parent of Tasks through Epics. So will the validator work between Epics and its Issues of any type?

Pete Singleton
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2018

Yes it should.  You can link Tasks to Epics in the same way you would with Stories.  Make sure the Task create/edit/view screens all have Epic Link as a field.

Amarendar Musham - Consultant May 23, 2019

how to check the stories in epic.. 
I'm seeing under validator called Linked Status (JSU).. But I'm not able to find the right option for the below collumn

  • Issues which are linked as : 
Nigel Budd (CV)
Contributor
September 9, 2019

@Amarendar Musham if you have JSU, use a JQL Condition (rather than a validator), it achieves a similar goal but doesn't show the transition button or allow the drag on the Kanban view.

 

You need to configure a JQL statement that checks that all child issues are done, for example:

  • JQL Expression: issue in childIssuesOf({issue.key}) and status != Done
  • Number of Issues found: Must not find issues
Like Sima likes this
Sima
Contributor
April 19, 2021

@Nigel Budd (CV)Thank you very much for this easy solution using JSU - it worked perfectly for me with your instructions. You really helped me out here and saved me time!

Gianluca Fonte April 19, 2021

Is there a comparable solution for Jira Cloud and, more specifically, for the Jira Next-Gen projects?

Like natalia.lezhai likes this
Muhammad Moazzam Hassan
Contributor
January 6, 2023

Rather than investing money in the apps, build the logic. 

Create an automation rule on which when all tasks inside epic move to Done or Closed then add the value to custom number field = 1, then add the workflow condition of number field value must be equal to 1.

Renni Verho
Contributor
January 6, 2023

Automation rule with JQL check would be possible too

Suggest an answer

Log in or Sign up to answer