Hello,
I want to implement a solution where 3 different custom fields will be automaticly show / hide depends on value in other custom field.
At this moment I have four diffrent cf:
- CustomX - select list (single choise). I have an options: Test1, Test2, Test3, Test4, Test5, Test6
- CustomA - Checkbox
- CustomB - Checkbox
- CustomC - Checkbox
I created Behaviours (Scriptrunner) but don't work properly. My Beahaviors:
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.component.ComponentAccessor
def CustomXField = getFieldByName("CustomX")
def CustomAField = getFieldByName("CustomA")
def CustomBField = getFieldByName("CustomB")
def CustomCField = getFieldByName("CustomC")
def wybranytyp = CustomXField.getValue()
log.warn "typ :" + wybranytyp
if (wybranytyp == "Test1") {
CustomAField.setHidden(false)
CustomBField.setHidden(true)
CustomCField.setHidden(true)
if (wybranytyp == "Test2") {
CustomAField.setHidden(false)
CustomCField.setHidden(true)
CustomBField.setHidden(true)
if (wybranytyp == "Test3") {
CustomAField.setHidden(false)
CustomCField.setHidden(true)
CustomBField.setHidden(true)
if (wybranytyp == "Test4") {
CustomCField.setHidden(false)
CustomAField.setHidden(true)
CustomBField.setHidden(true)
if (wybranytyp == "Test5") {
CustomCField.setHidden(false)
CustomAField.setHidden(true)
CustomBField.setHidden(true)
if (wybranytyp == "Test6") {
CustomBField.setHidden(false)
CustomAField.setHidden(true)
CustomCField.setHidden(true)
}
else {
CustomAField.setHidden(false)
CustomBField.setHidden(false)
CustomCField.setHidden(false)
I don't know what I made wrong.
Best regards,
Bartosz