So i created a Scriptrunner Behaviour to add some servor side validations on a custom field. It works fine someone is editing the field through UI. But at the same time when someone edits the field using the Jira REST API, the validations aren't applied.
Do i need to add something else to make it work? Please suggest.
Here is my code snap:
def fieldToHide = getFieldByName("abc")
def urgencia = getFieldByName("def")
def optionValue = urgencia.getValue().toString()
fieldToHide.setHidden(true)
if (optionValue == 'xxx') {
urgencia.setError("You cannot enter xxx")
}
else {
fieldToHide.setHidden(false)
}