Skip to main content
Example scripts
arrow icon
To homepage
Jira
Cloud icon
Cloud

Change Epic Status Field When Resolution Gets Set

Features
Listeners
Created 1 year ago, Updated 1 day(s) ago
App in script
ScriptRunner For Jira
ScriptRunner For Jira
by Adaptavist
Compatibility
compatibility bullet
Jira
Language |
groovy
def eventIssue = Issues.getByKey(issue.key as String)

def resolutionChange = changelog.items.find {
    (it as Map).field == 'resolution'
} as Map
logger.info("The resolution change of issue '${eventIssue.key}': ${resolutionChange}.")
def newEpicStatusValue = (resolutionChange?.toString == 'Done') ? 'Done' : 'To Do'

logger.info("The epic status value is: ${newEpicStatusValue}.")

if (!resolutionChange) {
    logger.info("The resolution didn't change.")
    return
}

logger.info("Updating Epic Status field Epic Status to '${newEpicStatusValue}'.")

eventIssue.update{
    setCustomFieldValue('Epic Status', newEpicStatusValue)
}
Having an issue with this script?
Report it here