Hi folks
I Am trying to validate a single-line text box to include $ values like $1020.00 and this is the behavior on the custom field. I see no error and still can't have this behavior working
def field = getFieldById(getFieldChanged())
def val = field.getValue() as String
if (!val.matches("\$[0-9].[0-9]{2})")) {
field.setError("Amount must be in dollar format.")
} else {
field.clearError()
}
The options selected are not strings, they are option objects. If you want to work with just the option's name (as it appears to your humans), you should use .getValue() to get the name out of the option.
Thanks for your response..!!
def chkBxFld = ComponentAccessor.getCustomFieldManager().getCustomFieldObject('customfield_10563');
we are getting null pointer exception on null object , Can you guide me on right track with my code as i'm new to scripting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try
def customFieldName = "Name of your custom field"
def chkBxFld = customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName)
assert customField : "Could not find custom field with name $customFieldName"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.