Skip to content

Instantly share code, notes, and snippets.

@jechlin
Created August 27, 2014 19:24
Show Gist options
  • Save jechlin/3197c7a9d6542ac3cf53 to your computer and use it in GitHub Desktop.
Save jechlin/3197c7a9d6542ac3cf53 to your computer and use it in GitHub Desktop.
FormField fixfield = getFieldById(getFieldChanged())
def versions = fixfield.getValue() as List<Version>
// Make sure all versions consist of 2 '.' separated numeric fields.
// sometimes versions list can have a null in it... don't ask
versions.remove(null)
def badVersionNames = versions.findAll {! it.name.matches(/^\d+\.\d+$/)}*.name
if (badVersionNames) {
fixfield.setError("'Fix Version/s' must consist of 1 or more versions with 2 '.' separated numeric fields (ex: 14.1) " + badVersionNames + "}")
}
else {
fixfield.clearError()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment