I would like to require a text field (or a single-select dropdown) based on the value selected in the Component/s field. (The custom fields are Acceptance Criteria and Code review required?)
I have:
- created a behavior
- mapped the behavior to a project and issue type
- selected a workflow from the Guide Workflow dropdown
- added the Component/s field
- added a condition: Workflow Action: Create
- added a server-side script:
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def componentField = getFieldByName("Component/s")
def acceptanceCriteriaField = getFieldByName("Acceptance Criteria")
String componentValue = componentField.getValue()
if (componentValue == "AI Platform") {
acceptanceCriteriaField.setRequired(true)
}
else {
acceptanceCriteriaField.setRequired(false)
}
I am unable to make this work and could use some advice.