Skip to main content
Example scripts
arrow icon
To homepage
Jira
Data centre icon
Data Center

Close an Epic when all the Issues Under that Epic are Closed

Created 1 year ago, Updated 6 month(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira (8.0 - 8.19)
compatibility bullet
ScriptRunner For Jira (7.10.0)
Language |
groovy
def epicIssue = issue.epic

if (!epicIssue) {
    return
}

// Find all unresolved stories
def openStories = epicIssue.stories.findAll { !it.resolution }

// If there are still open stories (except the one in transition) - then do nothing
if (openStories.size() > 1) {
    return
}

epicIssue.transition('Done') {
    setComment('This Epic closed automatically because all the issues in this Epic are closed.')
}
Having an issue with this script?
Report it here