Behaviours plugin filter cascading select list values based on project selection on issue creation

Using the plugin, I would like to filter the parent values of a cascading select list.  I use the following to filter a single select list and it works fine.  

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def formField = getFieldByName("System") 
def customField = customFieldManager.getCustomFieldObject(formField.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsMap = options.findAll {
    it.value in ["ATLAS Cotton",
"C4",
"LDC Insight",
"LDC CRM",
"LATAM C4",
"LATAM DCentral"] 
}.collectEntries {
    [
        (it.optionId.toString()) : it.value
    ]
}
formField.setFieldOptions(optionsMap)

5 answers

This widget could not be displayed.

What's the question?

This widget could not be displayed.

I guess the question is how to do the above with a cascading select.

This widget could not be displayed.

Hi Todd,

If I understand well, you need to determine if an option in a cascading list is a parent option or not. If that is the case you can use in your's findAll closure

it.getChildOptions()

If the option is a parent option this will return to you it's children, if not then it will return null.

This widget could not be displayed.

Jamie, That is correct, how do I filter cascading select using something similar to the above. I only need to filter the parent level selections.

This widget could not be displayed.

I think you want to set the values of a cascading select? I think this is still not supported. 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

189 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you