behavior_validateMaxLenghAndNumericValue_customField
Wed Nov 13 2024 19:38:27 GMT+0000 (Coordinated Universal Time)
Saved by
@belleJar
#groovy
//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();
}
content_copyCOPY
field validate number <100
Comments