Heads up! ScriptRunner documentation is moving to docs.adaptavist.com. Adaptavist will keep this site up for a bit, but no future updates to documentation will be published here. ScriptRunner 6.20.0 will be the last release to link to scriptrunner.adaptavist.com for in-app help.

Require Fix Version if resolution is Fixed

This simple example requires the user to enter at least one fix version if the resolution is Fixed. Although this can be done in multiple other ways, eg with the Behaviours plugin, this is the most straightforward way.

import com.opensymphony.workflow.InvalidInputException

if (issue.resolution.name == "Fixed" && !issue.fixVersions) {
    throw new InvalidInputException("fixVersions",
        "Fix Version/s is required when specifying Resolution of 'Fixed'")
}
It is easier to use a Simple Scripted Validator to do this.

Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.

Ask a question about ScriptRunner for JIRA, Bitbucket Server, or Confluence.

Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.