The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Behaviours - Restrict component list based on another field

Jiri Kanicky
February 27, 2020

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events