It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to limit Number Field to a range of natural numbers (with Script Runner)

Michaela Gluchow Nov 02, 2017


I am looking for a way to limit the range of a number field to a certain range of natural numbers. This should always apply and not only in a certain workflow step. I tried to add Javascript to the description as described here. But I guess I am lacking of some important details. 

I thought of using Behaviors provided by Script Runner but also lacking of the implementation details. Perhaps someone has some hints or even a detailed description of how to do it.



1 answer

0 votes
Alexey Matveev [cPrime] Community Leader Nov 02, 2017


You need to create a behavour. In the field part of the behavour add your customfield. Then push create serverside script button. I am not sure that I understand correctly your required condition but the script will be like the following:

def cs = getFieldByName("CustomFieldNAme")

if (cs.getValue().toString().length() < 2) {
  cs.setError("Hello error")
} else {

You can read more about behavours here:

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Marketplace Apps & Integrations

Demo Den Ep. 4: Continuous Integration with CircleCI & Jira Software

Get ready! Demo Den Episode 4 is coming your way on Tuesday, May 28, 2018 with a Continuous Integration and Delivery special demo. CircleCI Director of Solutions Engineering, Eddie Webb will show us ...

451 views 0 4
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you