I've used this trick for Behaviours so many times without fail, but for some reason I can't get it to work for a custom field Version Picker (single select).
If any option is selected for Version Picker, another custom field "Text Multi-line" appears.
But if Version Picker is empty, I want the text field to hide. I've tried variations:
def field = getFieldByName("Version Picker")
def fieldValue = field.getValue()
def text = getFieldByName("Text Multi-line")
if (fieldValue != null) {
text.setHidden(false)
}if (!fieldValue) {
text.setHidden(false)
}def fieldValue = field.getValue() as String
if (fieldValue != "Unknown") {
text.setHidden(false)
}
But none of them work. If Version Picker is null/Empty, then the text field needs to hide.
(Or in the case of this script logic: If Version Picker IS NOT null/empty (a value was selected), then Text field IS NOT hidden.)
Does anyone know what I'm missing?