Use Behaviours to include a link to duplicate issues

Solution

  • Use a ScriptRunner Behaviour to ensure users include links to duplicate issues

Step 1

Choose JIRA Admin --> Add-ons and navigate to the ScriptRunner Admin function "Behaviours"

OR type "." and then "behaviours" 

 

 

Step 2

Type in the name and description of your new Behaviour and click on the Add button

 

 

 

Step 3

Choose the "Add Mapping" link next to your newly created Behaviour

Step 4

Choose the newly created "Resolution Duplicate" Behaviour ID from the available drop-down

Select the appropriate Issue Types (if in doubt choose "Any issue type" to ensure you can see it working)

Select the appropriate Projects and click on the button

 

 

 

Step 6 - Choose a Guide Workflow from the dropdown list

 

 

Step 8 - Add the script

Add the script to the dark blue "Script" in-line editor like the below code block and Click on the button

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

 

 

In the Add Field section find the Resolution field in the dropdown list and click on the button