Need help with writing a Behaviour for Script runner

Hi guys,

I am trying to set a behavior, but it is very hard because I do not have any coding background. The idea is that the ticket creation screen would hide/show fields depending on what the user chooses.

I just need the screen to change depending on what the user chooses. There are 3 options in the dropdown menu and if he chooses one of them, lets say option one, a field should show up that asks for a transaction number, if he chooses option two per say, another field should pop up asking for the software he is using, and if he chooses the third one, nothing should change.

Any help is greatly appreciated! Thanks in advance!

Hi. We’re talking on reddit also. An example is here:

def field = getFieldByName("Standards")
def otherField = getFieldByName("Other")

if(field.getValue() == "MyCoolValue"){
    otherField.setHidden(true).setRequired(false).setFormValue("")
} else{
    otherField.setHidden(false).setRequired(true)
}
3 Likes

I’ve been trying to fix this all week, it finally works. Thank you so much!!

1 Like