I am trying to implement one code to get a set of values listed in select list based on the value selected in a check box.
I have implemented the below code. But it is not working.
Can you please help me to investigate on this?
This is the code:
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
FormField checkBox = getFieldById("customfield_20690")
def selectList = getFieldById("customfield_13992")
def customField = customFieldManager.getCustomFieldObject(selectList.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def checkBoxVal = checkBox.getValue()
if (checkBoxVal == "A") {
def optionsMap = options.findAll
{ it.value in ["AB", "BC"] }
.collectEntries
{ [(it.optionId.toString()): it.value] }
selectList.setFieldOptions(optionsMap)
} else if (checkBoxVal == "B") {
def optionsMap = options.findAll
{ it.value in ["C", "D", "E"] }
.collectEntries
{ [(it.optionId.toString()): it.value] }
selectList.setFieldOptions(optionsMap)
}