Script for hiding a field based on the select list value

GSuseela January 28, 2020

Hi,

I have written a script regarding hiding a number field based on the values in the select list custom field. But it is throwing an error.

Could you please help me on this.

Regards,

Suseela

1 comment

Ganesh Babu
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2020

Hi @GSuseela 

Are you using a scriptrunner for this? In that case i will provide you a script which works

This hides a Text Field based on what value is in a Single Select List

def textField = getFieldByName("TextFieldB")
def selectList = getFieldByName("SelectListA")

def selectListValue = selectList.getValue()

if (selectListValue == "AAA") {
textField.setHidden(true)
} else {
textField.setHidden(false)
}

This Behaviour is meant to go on the field you are basing the Behaviour on. In your example, you want to hide the Field A based on Field B. So the Behaviour should be put on Field B so that it is triggered every time the field is changed.  

Like # people like this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events