Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to create a number field in jira with 0 to 9 value no sytex

Lola March 27, 2019

Need a number field with a minimum value of 0 or 1 and the length should be 9. I don't know if this is achievable with number field. The reason is that I don't want users to enter any negative value (-1233). and we don't want the number value to have any decimal or delimiter(123,456). All we need is (0123456789). Really need help with this. Any idea

1 answer

0 votes
Alexey Matveev
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.
March 27, 2019

Hello,

You would need a plugin for it.

There are 2 way to implement it with plugins:

1. You can use plugins like Power Scripts or ScriptRunner to implement a validator for the field.

If you want to use the Power Script app, then the code for validator would look like this:

string str = #{Your custom field name};

if (#{Your custom field name} < 0 or lenght(str) > 9) {

   return false, "This custom field my be positive with the length less than 9 symbols"

}

return true;

2. You could use plugins, which will let you create a custom field and check for validity. For example, you could use the Power Custom Field Premium add-on.

You would create a regex field with a regex expression like this:

^\d{9}$

Lola March 28, 2019

Thank you so much your quick response. We currently don't have Power Script app in my environment but we have Script runner. 

Suggest an answer

Log in or Sign up to answer