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,369,285
Community Members
 
Community Events
168
Community Groups

Behaviours - Restrict component list based on another field

Edited

I am trying to restrict component list field based on Product field, using example in here

Any idea why its not working?

If product field = Infinity Fabric
   List only "App Viewer" component

import com.atlassian.jira.component.ComponentAccessor
static com.atlassian.jira.issue.IssueFieldConstants.*

def productField = getFieldById(getFieldChanged())
def selectedOption = productField.getValue() as String

if (selectedOption == "Infinity Fabric") {
def constantsManager = ComponentAccessor.constantsManager
def allowedComponents = constantsManager.components.findAll {
it.name in ["App Viewer"]
}

getFieldById(COMPONENTS).setFieldOptions(allowedComponents)
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events