Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cascade Select List setFieldOptions for children groovy

Carlos David October 14, 2019

 

How can I restrict parent *and child values* in a cascading select list using groovy / Script Runner?

 

Set form values is straight forward:

https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/setting-default-fields.html

and I know how to set single select list options:



def customField = customFieldManager.getCustomFieldObjectByName(fieldName)
def fieldConfig = customField.getRelevantConfig(getIssueContext())

def options = optionsManager.getOptions(fieldConfig)

def optionsMap = options.findAll {
it.value in ["TBD"] // list of options you want to show
}.collectEntries {
[
(it.optionId.toString()): it.value
]
}


field.setFieldOptions(optionsMap)


What form should the optionsMap take for cascading select list? Map[ OptionsId, {value list}]? 

 

Any help would be hugely appreciated!

 

 

 

1 answer

0 votes
Ravi Sagar _Sparxsys_
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.
October 15, 2019

Hi @Carlos David 

I recently answered a similar question few days ago. Take a look here.

You can try something like this.

def parentField = getFieldById("customfield_10802")
def parentFieldValue = parentField.getValue()
def childField = getFieldById("customfield_10802:1")
def childFieldValue = childField.getValue()

Let me know if this works.

Ravi 

Carlos David October 15, 2019

Hi Ravi,

I want to set the parent and child options in the cascade select list, not get the values. I don't think this is possible however.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events