Hello!
I am currently using 4 nFeed fields (let's say A, B, C and D) in my request type. When a customer is selecting option 1 in the A field, I would like to be able to set field B, C and D required.
Here is what I wrote in my Behaviour:
import com.onresolve.jira.groovy.user.FormField;
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.priority.Priority
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
FormField subLevel1Field = getFieldById("customfield_13009")
FormField subLevel2Field = getFieldById("customfield_13010")
FormField subLevel3Field = getFieldById("customfield_13011")
FormField productField = getFieldById("customfield_13008")
String[] productFieldValue = (String[]) productField.getFormValue()
if (productFieldValue[0].equals("THETRAWIN")) {
subLevel1Field.setRequired(true)
subLevel1Field.setLabel("Sous-catégorie 1 *")
subLevel2Field.setRequired(true)
subLevel2Field.setLabel("Sous-catégorie 2 *")
subLevel3Field.setRequired(true)
subLevel3Field.setLabel("Sous-catégorie 3 *")
}
else {
subLevel1Field.setRequired(false)
subLevel1Field.setLabel("Sous-catégorie 1")
subLevel2Field.setRequired(false)
subLevel2Field.setLabel("Sous-catégorie 2")
subLevel3Field.setRequired(false)
subLevel3Field.setLabel("Sous-catégorie 3")
}
Also FYI:
- The setLabel part is working.
- In the request type configuration, subLevel fields are set to be optional. If I set them as required, it doesn't change anything.
Thanks in advance for your help,
Florian