Hi Guys,
I am not a coder so I need some help here.
We are on Jira 8.5.x. We have a requirement. There are two select list custom fields.
Suppose Field1and Field2.
If I am selecting "A" from Field1 then Field2 should show these options: "Value1", "Value2"
And if I am selecting "B" from Field1 then Field2 should show: "Value3", "Value4"
I tried and created the below code but it is not working.
"
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager
def Field2 = getFieldById("customfield_10500")
def Field1 = getFieldById("fieldchanged")
def Field2Value = customFieldManager.getCustomFieldObject("customfield_10500")
def Field1Value = Field1.getValue()
def options = optionsManager.getOptions(Field2Value)[0]
if (Field1.value == "UC") {
def allowedField2 = options.findAll { it.value in ["Value1", "Value2"] }
Field2Value.setFieldOptions(allowedField2)
} else if ((Field1.value == "DevOps")) {
def allowedField2 = options.findAll { it.value in ["Value3", "Value4"] }
Field2Value.setFieldOptions(allowedField2)
}
"