//File: src/JiraStuff/groovy/M/ToBePaid_ValidateMaxLengthNumeric.groovy
//Field: % to be Paid - customfield_10530
//Description: Validate max length and numeric
String strVal = getFieldById(getFieldChanged()).getValue().toString()
if( strVal.length() > 0 ) {
strVal.find("[^0-9]|.{4,}") || strVal.toInteger() > 100 ? getFieldById(getFieldChanged()).setError('This field only allows 3 numeric characters and no more than 100') : getFieldById(getFieldChanged()).clearError();
} else {
getFieldById(getFieldChanged()).clearError();
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter