I have a task to hide child values for a cascading custom field for a specific customer request type
I hide parent options from a cascading field with script runner behaviours
import com.atlassian.jira.component.ComponentAccessor
def reqType = getRequestTypeName()
def issueCategory = getFieldById("customfield_11000")
def tempcat
def tempcat2
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObject(issueCategory.getFieldId())
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionToSelect
if (reqType == 'Req type name') {
tempcat = "Parent value"
tempcat2 = ""
issueCategory.setFormValue([tempcat,tempcat2])
optionToSelect = options.findAll { it.value in ["Parent value"]}
issueCategory.setFieldOptions(optionToSelect)
}
but i can't hide child options.
To make it clearer, I have a cascading field in which there is a parent value A and child values A1, A2, A3. I need to hide the value of A2.
Maybe someone can help me solve this problem.
Thank you.