INTRO
My brain feels like a jumbled mess now that I tried to do this, so I thought, I'll get some help!
CASE:
Our organization decided to limit the FixVersion/s field to only 1, and to make the field required... so I set out on that journey. I used the workflow transitions to check the number of FixVersion/s using a scripted validator, and I used the behavior's functionality to make it a required field, and so far that has worked.
PROBLEMS:
(1) People can still go to the edit screen, adjust the FixVersion count, and nothing will stop them from updating it because that logic only runs on a workflow transition.
(2) Issues that had multiple FixVersion/s before I made the changes above are still able to use the quick transition buttons move an issue through it's status, and nothing this behavior even though it's a required field, and there is a validator script.
(3) The server side validation for behaviors seems to be very limited as to what you can do with .getValue()... I'm not able to use .size() or .length() (that I know of) to check the number of FixVersion/s.
CODE:
I put some of the server side code I tried to write to run this check, but I don't think I made it very far.
def fixVersionsField = getFieldByName("fixVersions")
if (fixVersionsField.getValue() == null || fixVersionsField.getValue() == "" ){
fixVersionsField.setError("Version must be populated.")
} else if () {
// I deleted this, but thought someone here might be able to help me.
}