Hi,
I was working on a script to display helper text on a cascading field based on values selected in the Parent and Child Option.
Below is the script I am using however it doesn't seem to be working. Inputs would be helpful.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
@BaseScript FieldBehaviours fieldBehaviours
//get the custom field details
def customField = getFieldByName("Root Cause (new)")
//get the cascade field value
//def cfAValue = customField.value as List
//for debug purpose
//log.warn "cfAValue: " + cfAValue
if (cfAValue) {
//Size at least 2 [parentValue, childValue]
if (cfAValue.size()>1) {
//The 1st value will be your parent value, and the 2nd value will be your child value:
def parentValue = cfAValue.get(0)
def childValue = cfAValue.get(1)
//For debug purpose
//log.warn "cfAValue: ${cfAValue}"
//log.warn "parentValue: ${parentValue}"
//log.warn "childValue: ${childValue}"
if(parentValue.toString().contains("Data Issue") && childValue == "Coding Error"){
customField.setDescription("Test")
} else {
customField.setDescription(null)
}
}
}
Thanks