I'm looking for a certain groovy script I could use in ScriptRunner's Behaviours for my custom field that uses the Version Picker (multiple) type.
For our project, we have multiple Releases (e.g. 101, 102, 103, 201, 202, 203 etc) and we always add more release numbers throughout the year.
We use a custom fields to help filter, but we want to show only the 200s options. We use Version Picker custom field because on JQL query, it's easier to search: customfield >= 200, and we'd never have to change that query.
My question, is there a script I could use in Behaviours set to the custom field so that it searches using a wildcard for the different versions available in our project, and then hides the other options (the 100s) from being selected?
Right now I have this that works for now, but I'd rather not have to update this script every time we create a new version number:
def field = getFieldByName ("Version Picker Option")
def version = field.getValue() as Collection
def options = field.setFieldOptions (["200","201","202"]) //must update every quarter, but would rather there be a wildcard option
if (options == true){
field.setValid(false)
field.setError("Version/s can not be a 100s")
}else {
field.setValid(true)
field.clearError()
}