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!
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.