Hi,
I just started using Scriptrunner and already have a problem I can't solve for some while now.
I have 3 fields. A, B and C.
If A or B have the value "Yes" then C should be required. Else it should be optional.
I tried the following code in a field behavior and it works for one field (the one I put the code into) but not for both at the same time.
def c = getFieldByName("C")
def a = getFieldByName("A")
def b = getFieldByName("B")
def aOption = a.getValue() as String
def bOption = b.getValue() as String
def isA = aOption == "Yes"
def isB = bOption == "Yes"
if (isA || isB){
c.setRequired(true)
} else {
c.setRequired(false)
}
Can somebody tell me how I can make this work for both fields at the same time?
Thank you.