Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,778
Community Members
 
Community Events
168
Community Groups

Behaviors - How to restrict versions to unarchived?

How to restrict versions to only unarchived based on this script?

 

// Sets versions
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

import static com.atlassian.jira.issue.IssueFieldConstants.AFFECTED_VERSIONS

@BaseScript FieldBehaviours fieldBehaviours

def versionManager = ComponentAccessor.getVersionManager()

def issueTypeField = getFieldById(AFFECTED_VERSIONS)
def fieldOptions = versionManager.getVersions(issueContext.projectObject)
def availableOptions = []

availableOptions.addAll(fieldOptions.findAll { it.name.startsWith("T24 Transact") })

issueTypeField.setFieldOptions(availableOptions)

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events