Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set a length size on a custom field using scriptrunner behaviour

Basilio October 27, 2016

I'd like to set a size in a custom field. I need allow only 32 characters

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Thanos Batagiannis [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2016

Hi Luis,

Try 

def field = getFieldByName("TextFieldA")
if ((field?.value as String)?.length()  > 32) {
    field.setError("Length of the field should be less than 32 chars")
} else {
    field.clearError()
}

regards, Thanos

TAGS
AUG Leaders

Atlassian Community Events