Remove None from cascade list with Behaviour

Carlos David August 24, 2017

I would like to remove 'None' as an option in the sublist of a cascading select list, but am unable to access the sublist values. I've looked at older solutions but can't seem to make any headway.

I have the following code:

def customFieldManager = ComponentAccessor.getCustomFieldManager()


def cField = customFieldManager.getCustomFieldObjectByName("Entity")
def fieldConfig = cField.getRelevantConfig(getIssueContext())
Options options = optionsManager.getOptions(fieldConfig)

Map<String, Object> optionsMap = options.findAll {
it.value != "None"
}.collectEntries{
[
(it.optionId.toString()): it.value
]
}

log.debug "new Entity options: " + optionsMap.toString()

// Get a pointer
FormField entitySelectList = getFieldByName("Entity")
entitySelectList.setFieldOptions(optionsMap)

thanks for any help

 

 

 

 

 

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events