Show only unreleased version in Fix Version field

Krishnanand Nayak
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2019

Need help with implementing a behavior that will only show version with Unreleased status in the Fix Versions field. 

1 answer

1 accepted

2 votes
Answer accepted
ofir gutmacher August 13, 2019

you need to do some prerequisites:

1. Download Adaptivist ScriptRunner (+ Behaviour)

2. click on "Manage Apps" -> "Behaviours"

3. Under "Behaviour Settings" make sure you delete/remove any initialisers if they exist

4. Under "Fields" select Fix Versions

5. Under "Fields" select Affects Versions.

6. on both oaccasions, create  aserver side script.

7. on both occasions, copy the following script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.project.version.VersionManager

def versionManager = ComponentAccessor.getVersionManager()

def fixver = getFieldById("fixVersions")
def affver = getFieldById("versions")

Long projectId = issueContext.projectObject.id
boolean includeArchived = false


List<VersionManager> versions=versionManager.getVersionsUnreleased(projectId,includeArchived) as List


affver.setFieldOptions(versions)

fixver.setFieldOptions(versions)

 

8. Save

9. Add Mappings

10. Map it to "All projects", "All Issue types"

11. Save

 

Thats it.

SKAdmin December 12, 2023

@ofir gutmacher -

This is amazing, but is there anyway to correct the sorting problem? When you start typing to search for a fix version it puts the version at the bottom of the list so the user has to scroll to the bottom to select the version. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events