My requirement is: When XXX is selected for a field, the link is not required, otherwise it is required.
def phaseField = getFieldById(getFieldChanged())
def selectedOption = phaseField.getValue() as String
def linkid = getFieldById("issuelinks")
if(selectedOption != "XXX" ){
linkid.setRequired(true)
}
else{
linkid.setRequired(false)
}
The execution result is: when XXX is selected for a field, the question display of setting link is not required (that is, there is no red meter before the field), but it is still prompted to be required when submitting