Hi All,
I created a text field and converted it into a single Select by populating the master data list fetched from the rest endpoint. Behavior script converts into single select on page initialize.
Now fetch some data from other rest endpoint and populate to multiple fields, however not able to populate the value to this single select field since it is converted through script runner.
The value i'm populating ( set form value ) to this field is already part of the select list options.
Please advise.
on initialise script in behaviour :
getFieldByName("vendors").convertToSingleSelect([
ajaxOptions: [
url : "http://localhost:8080/rest/scriptrunner/latest/custom/VendorTypes",
query: true, // keep going back to the sever for each keystroke
minQueryLength: 0,
keyInputPeriod: 500,
formatResponse: "general",
]
])
Second Behaviour script (Server Side0:
if(lotControl!=null){
def field = getFieldByName(vendorFieldName)
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(vendorFieldName)
def fieldConfig = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(fieldConfig)
def option = options.find {it.value== lotControl}
field.setFormValue(option.optionId)
}
maybe this is works:
def options = [:]
options << [(lotControl):(lotControl)]
field.setFieldOptions(otions)
field.setFormValue(lotControl)
without "optionsManager"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.