When you mark an issue as Resolved with the resolution of Fixed, you want the developer to specify a Fix Version. However, it doesn’t make sense to require a fix version when the resolution is Won’t Fix.

Solve this using a server-side validator to mark the Fix Version field as required, only when the resolution is Fixed.

  1. Create a new behaviour.

  2. Click Add Field, and add the Resolution field. Our server-side script, when written, is called the first time this field appears, and any time the user changes it in the dialog.
    add field resolution

  3. Click Add Server-side Script.

  4. Enter the following script:


    import com.atlassian.jira.issue.resolution.Resolution
    
    def resolutionField = getFieldById("resolution")
    def fixVersionsField = getFieldById("fixVersions")
    
    def resolution = resolutionField.getValue() as Resolution
    
    if (resolution.name == "Fixed") {
        fixVersionsField.setRequired(true)
        fixVersionsField.setHidden(false)
    } else {
        fixVersionsField.setRequired(false)
        fixVersionsField.setHidden(true)
    }


    This example sets the Fix Versions field to required and shown if the resolution is Fixed, and to optional and hidden if the resolution is anything else.

To test the script, Resolve an issue. Experiment with changing the resolution value. The Fix versions field should change accordingly. A good experiment now would be to modify the script so that instead of hiding the field it’s made read-only. To do, change setHidden to setReadOnly.

If you have created a new behaviour do not forget to map it to a project, or project/issue type combination.

You might want to do something similar whereby if the Duplicate resolution is selected, the Linked Issues field is shown, if there not already a Duplicate link for that issue.