I am using Scriptrunner Cloud Behaviours to display/hide field based on another field's value.
Field changed and field to be hidden/displayed are of single select type. This field type is supported by behaviours (https://docs.adaptavist.com/sr4jc/latest/features/behaviours).
Based on the documentation, I would want to display the field only if the value of another custom field is true (https://docs.adaptavist.com/sr4jc/latest/features/behaviours/behaviours-api)
While I am able to hide the affected field on load using .setVisible(true), I am unable to display the field on change using .setVisible(false).
Below is my code snippet.
const fieldChangedValue = getFieldById("customfield_10255").getValue().name;
const siteCF = getFieldById("customfield_10254");
if (fieldChangedValue == "Site"){
siteCF.setVisible(true);
}
Any advice?
hi!
this method makes your customfiled hidden
getFieldById("customfield_10254").setVisible(false);
if you want to hide your field in default view and show it for option "Site", you need to use this code
getFieldById("customfield_10254").setVisible(false);
const fieldChangedValue = getFieldById("customfield_10255").getValue().name;
const siteCF = getFieldById("customfield_10254");
if (fieldChangedValue == "Site"){
siteCF.setVisible(true);
}
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.