I need to make a field called "Reason for Cancellation" mandatory if in the resolution of the problem it selects Canceled. But the script is not doing this function.
If not cancelled, the field must be optional.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def resolution = getFieldByName ("Resolution")
def motivo = getFieldByName ("Motivo do Cancelamento")
motivo.setRequired(false)
def selectListValue = resolution.getValue()
if (selectListValue == "Cancelado") {
motivo.setRequired(true)
}
But the script above is not working.