Behaviours and Checkboxes script


This is my situation. I want to go to the next question (Question 5) if one of the questions (4.1, 4.2 or 4.3) have the checkbox “Yes”. So when 1 of them is being checked with Yes it have to go to question 5. The rest of the questions don’t have to be answered then.

Could you please help me?


thanks for the help!

Hi, this should be for datacenter or cloud version?

Hi, this is for datacenter

Hi, so using this example of Library, undefined - Adaptavist Library

You should configure the Behaviour on the fields 4.1: Question 4.1, 4.2: Question 4.2 and 4.3: Question 4.3

so with this code, you can get the selected value:

def checkBoxField = getFieldById(fieldChanged)
def checkBoxFieldValue = checkBoxField.value

// Collect the selected checkbox values
log.debug("The checkbox field value: '${checkBoxFieldValue}' of type '${checkBoxFieldValue.class.simpleName}'")
def chosenValuesList = []
if (checkBoxFieldValue in String) {
} else if (checkBoxFieldValue in ArrayList) {

and with that information you can check the following and make the otherField, in your case the questions that should be set as setHidden(true) to hide them, or .setReadOnly(true) to block the fields 

// If the user has selected "None" and nothing else, don't force to populate the other field:
def otherField = getFieldByName(otherFieldName)
if (chosenValuesList == ['None']) {

Let me know if this helps to you!
Regards, Ivan.