Hi,
what I want to do is to ensure, that the fixVersion field has to has at least one valid value*.
Empty fixVersion is also allowed.
*I define valid values as values that meet a certain regex like /S\d{8,8}/
e.g.
Got the following code:
import java.util.regex.Pattern
import java.util.regex.Matcher
def fixVersionsField = getFieldById("fixVersions")
def fixversion = fixVersionsField.getValue() as Collection
def pattern = ~/S\d{8,8}/
def matcher
def isConform = false as boolean
Iterator itr = fixversion.iterator();
while(itr.hasNext()) {
Object element = itr.next();
matcher = element.toString() ==~ pattern
if(matcher.find()){
isConform = true;
}
}
if(!isConform){
fixVersionsField.setError("errormsg")
}
if(fixversion.isEmpty() || isConform){
fixVersionsField.clearError()
}
The code seems to work as intended but ONLY when release values are created in the first place.
If the person that has the permission to create new release versions and creates a new one by simply adding/creating new value though the create/edit issue screen the behaviour doesn't recognize invalid values.
Does somebody has a solution for this. Thanks in Advance!
For clearification I attach this screenshots.
"test" is a releases that was created before issue editing
"abc" is not yet created but will be created now
I made a view simple test with log output within the script and it seems that the behaviour script is triggered by adding a new release version like 'abc' in the example above, but it doesn't recognize the value as it does with existing values.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.