Hi,
I have a behaviour that converts another field into a MultiSelect list and retrieves the values of that list from an API REST, as we can see on the "Walkthrough - External REST Service" section of this official page: https://docs.adaptavist.com/sr4js/latest/features/behaviours/behaviours-examples/select-list-conversions
My multiselect list works fine when I'm on a form and I change another values. However, instead of show the label of every option in the list, I see the value key, which is stored in the field. How can I show the label instead of the value such as it works with the behaviour?
Next is the code of my behaviour and how I build the multiSelect list:
import com.atlassian.jira.component.ComponentAccessor
def tipoCaso = getFieldByName('Tipo de caso')
def servicio = getFieldByName('Servicio SalesForce')
def modulo = getFieldByName('Módulo SalesForce')
def campoServicio = ComponentAccessor.customFieldManager.getCustomFieldObjects(underlyingIssue).findByName('Servicio SalesForce')
def valorActualServicio = underlyingIssue.getCustomFieldValue(campoServicio).toString()
log.debug("Valor actual servicio")
log.debug(valorActualServicio)
log.debug("Valor cambio")
log.debug(getFieldById(getFieldChanged()).getValue().toString())
if (getFieldById(getFieldChanged()).equals(servicio) && (getFieldById(getFieldChanged()).getValue().toString() != valorActualServicio)) {
modulo.setFormValue(null)
def getOptionById = servicio.value.toString()//ComponentAccessor.getOptionsManager().getAllOptions().find{it.optionId == fieldChanged.value.toString()}
log.debug("Cambia el servicio")
modulo.convertToMultiSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/fnModulosPorServicio?servicioId="+getOptionById,
query : true, // keep going back to the sever for each keystroke
minQueryLength: 4,
keyInputPeriod: 500,
formatResponse: "general",
]
])
}
And this is what I see on the jira view, or when I tried to edit the fields:

Thanks in advance!