Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...


Code Block
//hide fields available for every Department selection
getFieldByName("Department 1 On-call team").setHidden(true);
getFieldByName("Department 2 On-call team").setHidden(true);
getFieldByName("Department 3 On-call team").setHidden(true);

//access to first-level MLCS value
FormField mlcs = getFieldById("customfield_11000:0");
String mlcsVal = mlcs.getValue();
log.debug("Department's First-Level value is " + mlcsVal);

//test value selected using optionId and then show desired the field
if("14100".equals(mlcsVal)){
    getFieldByName("Department 1 On-call team").setHidden(false);
} else if("14101".equals(mlcsVal)){
    getFieldByName("Department 2 On-call team").setHidden(false);
} else if("14102".equals(mlcsVal)){
    getFieldByName("Department 3 On-call team").setHidden(false);
}


5) Three different fields, each one related to a Department selected on the first level, will be hidden every time the Behaviour is executed (these three lines can also be added as a Initialiser script). Then, the first level of the Department field will be selected, its value will be logged and then the test will begin: depending on which value has been selected, one of the fields will be displayed.

Important: the value to test in the "if" is not the string value of the options but the IDs associated. The IDs can be retrieved using the MLCS configuration page, opening each option (as if you would have some more child options) and then looking at the "parentOptionId" value in the URL