Hi,
I've successfully converted a text field into a select list using behaviours and the convertToSingleSelect method and an REST Endpoint. This was done in the initialiser section of the behaviour.
But now I want to set a value into this field when another field is set. I was able to do this using another behaviour in another text field, but when I try to set the value to the field that is converted into a select list, it simply does not set the value.
I've searched the community and found this post regarding this issue: https://community.atlassian.com/t5/Jira-Core-questions/How-to-set-default-value-in-searchable-list-using-scriptrunner/qaq-p/452603?tempId=eyJvaWRjX2NvbnNlbnRfbGFuZ3VhZ2VfdmVyc2lvbiI6IjEuMCIsIm9pZGNfY29uc2VudF9ncmFudGVkX2F0IjoxNTY5MTY1MTg1MjU4fQ%3D%3D
Has anyone found a solution to this issue? If it is still not possible to set a value into a converted select list, then is it possible to disable the select list in the field and just set the value and mark the field read only if a condition is met?
Thank you.
Best regards,
Tomas Azevedo
convertSingleSelect and setFormValue don't seem to be able to work on the same field.
The only workaround I've found is to, instead of using ajaxOptions, you can either call your rest enpoint from the behavior script or gather the option values directly from groovy then add them to the converted field. In this case, the setFormValue will persist.
def map = [:] map['Test 1'] = "worked" map['Test 2'] = "worked2" map['Test 3'] = "worked3" map['Test 4'] = "worked4" def testField = getFieldByName("Test") testField.setFormValue(map.get('Test 1')) testField.convertToSingleSelect().setFieldOptions(map)
But when using this, you will lose the ability to filter your request in place using the ajaxOptions.query: true
Hi
The above helped me complete the overall solution.
I don't know if it's still up to date :-D.
This line can be added and it works:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.