limit character on custom field

I have a text custom field and would like to limit it to 70 characters or less. Is there a way to do this so whenever this field is present on any screen it only allows 70 chars?

1 answer

1 accepted

1 votes
Alexey Matveev Community Champion Oct 30, 2017

Hello,

if you have Adaptivist Scriptrunner you can develop a behavior or validator. If you do not have Scriptrunner you can download JsIncluder plugin (https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.jsincluder/server/overview) and write custom javascript for create,  edit and view screen. 

Hello Alexey,

I currently use a regex validator in the workflow as follows:
[A-Z a-z 0-9 ,.-]{1,70}$

However I dont like this method. Also the error message is ugly (See attached).

 

char_limit.JPG

Alexey Matveev Community Champion Oct 30, 2017

OK.  It s also a solution :)

Alexey Matveev Community Champion Oct 30, 2017

I will also try it.  Thank you

Ok. Still looking for a better way to do it.

Found it here:https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-set-a-length-size-on-a-custom-field-using-scriptrunner/qaq-p/554208

 

I am using behavior plugin

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

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,097 views 13 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot