Hi,
I have a script with which i hide some options from select list, and i wont to do same with cascading select list. I try to do it with this script but it does not works
import com.atlassian.jira.component.ComponentAccessor
def supLine = getFieldByName("cascading select")
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = customFieldManager.getCustomFieldObject(supLine.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsMap = options.findAll {
it.value in ["xxx"]
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
def parentOption = options.find {it.value == "xxx"}
def childOption = parentOption?.childOptions?.findAll {it.value in "yyy"
}.collectEntries {
[
(it.optionId.toString()) : it.value
]
}
supLine.setFieldOptions(childOption)
supLine.setFieldOptions(optionsMap)
Try to use HashMap
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
HashMap<String, Option> hashMapEntries = (HashMap<String, Option>) customFieldValue
Option parent = hashMapEntries.get(CascadingSelectCFType.PARENT_KEY)
Option child = hashMapEntries.get(CascadingSelectCFType.CHILD_KEY)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.