How to Hide a customfield when other customfield has no value?

Begoña Bonet June 22, 2015

Hi,

 

I'm using Behaviour plugin with this script associated to the customfield I want to hide:

 

FormField ci = getFieldByName("CI afectado")

if(ci.getValue() == ""){
getFieldByName("Proyecto de gestión (PdG)").setHidden(false);
}
if(ci.getValue() != ""){
getFieldByName("Proyecto de gestión (PdG)").setHidden(true);
}

In this case, the customfield "Proyecto de gestión (PdG)" is allways hidden.....

 

But...... if I use the next code:

FormField ci = getFieldByName("CI afectado")

if(ci.getValue() == null){
getFieldByName("Proyecto de gestión (PdG)").setHidden(false);
}
if(ci.getValue() != null){
getFieldByName("Proyecto de gestión (PdG)").setHidden(true);
}

In this other case, the customfield "Proyecto de gestión (PdG)" is allways shown.....

Where is my mistake?

 

Regards

 

Begoña

1 answer

1 vote
Alejo Villarrubia [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 25, 2015

It looks like ci.getValue() returns null always.

That explains that both ci.getValue() != "" and ci.getValue() == null are evaluated to true.

Suggest an answer

Log in or Sign up to answer