Hello!
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!
What do you mean by "go to the next question"?
When you go to the form question 4.1 pops up. When you answer "Yes" the other questions (4.2 and 4.3) are no longer relevant and you jump to question 5.
If 4.1 is answered with "No" question 4.2 pops up. Then the same happens, if 4.2 is "Yes" jump to question 5, if "No" question 4.3 pops up.
Hope this is helpfull and you can support me with the code ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in behaviors, in the issuetype field, set to hide the fields of questions 4.2, 4.3 and 5.
def question_41 = getFieldById("customfield_XXXX")
question_41.setHidden(false).setRequired(true)
def question_42 = getFieldById("customfield_XXXX")
question_42.setHidden(true).setRequired(false)
def question_43 = getFieldById("customfield_XXXX")
question_43.setHidden(true).setRequired(false)
def question_5 = getFieldById("customfield_XXXX")
question_5.setHidden(true).setRequired(false)
this way the creation screen will be loaded showing only question 4.1 on the screen (the others will be hidden)
again in behaviours, now in the field of question 4.1, configure it to display only 4.2 if the answer is no and display 5 if the answer is yes.
def question_41 = getFieldById("customfield_XXXX")
def question_42 = getFieldById("customfield_XXXX")
def question_43 = getFieldById("customfield_XXXX")
def question_5 = getFieldById("customfield_XXXX")
if (question_41.getValue == "No"){
question_42.setHidden(false).setRequired(true)
}
if (question_41.getValue == "Yes"){
question_5.setHidden(false).setRequired(true)
}
use practically the same code in the question field 4.2 changing only the reference field in ifs
def question_41 = getFieldById("customfield_XXXX")
def question_42 = getFieldById("customfield_XXXX")
def question_43 = getFieldById("customfield_XXXX")
def question_5 = getFieldById("customfield_XXXX")
if (question_42.getValue == "No"){
question_43.setHidden(false).setRequired(true)
}
if (question_42.getValue == "Yes"){
question_5.setHidden(false).setRequired(true)
}
in question 4.3 if you answer "No" nothing happens, but if you answer "Yes" it displays the field of question 5.
def question_41 = getFieldById("customfield_XXXX")
def question_42 = getFieldById("customfield_XXXX")
def question_43 = getFieldById("customfield_XXXX")
def question_5 = getFieldById("customfield_XXXX")
if (question_43.getValue == "Yes"){
question_5.setHidden(false).setRequired(true)
}
remember to change the customfield_XXXX to the correct id of your field.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Dante!
Thank you very much for your script!
I have still a problem to get it working perfectly.
Questions 4.1, 4.2 and 4.3 are configured as required. This because otherwise the option "none" is beeing displayed as one of the options (besides Yes an No).
When i configure the code below (example for only 4.2 question) for the questions 4.2 and 4.3 the questions are still required despite configurations says .setRequired(false)
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.