In Jira How to create Custom field with Number data type and assign specefic field length

Prasad April 25, 2012

Do you have any custom field type(number) where i can assign Field length?
I want to create new cusom field with NUMBER type and assign field length as 10

4 answers

0 votes
Prasad April 26, 2012

Nothign is working.

I dont think my java script is executing when i put the value in the custom field. DO i have to download any plugin or ENABLE JAVA SCRIPT in the jira console to make this java script working?

Please help me to fix this problem.

0 votes
Prasad April 25, 2012

When i add number below 10 degits to ACTUAL HOURS custom field it is taking, i get this error when i put more than 10 degits.

Please help me to fix this problem

Thanks

JamieA
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.
April 25, 2012

You're probably treating them as strings or something, use parseInt()

0 votes
Prasad April 25, 2012

Thanks for your reply.

I am getting following error when i add java script in the DESCRIPTION FIELD on ACTUAL Customer filed

org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][id,16853][issue,19904][numbervalue,1.2345678901234E13][parentkey,null][customfield,10051] (SQL Exception while executing the following:INSERT INTO jiraschemaqa44.customfieldvalue (ID, ISSUE, CUSTOMFIELD, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (Data truncation))

Added following Java script that in ACTUAL custom field DESCRIPTION, My custom filed type is NUMBER

<script type="text/javascript">
descField = document.getElementById('Actual');
descField.onchange=function(){
if (descField.value.length > 10){
alert("can only have 10 digits");
}
}
</script>

JamieA
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.
April 25, 2012

This can't be related to the javascript you added...

0 votes
Jobin Kuruvilla [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.
April 25, 2012

You can't define this without some workarounds. There are 2 options I can think of.

1. Add some Javascript in the field description that will limit the length to 10.

2. Modify the number velocity templates in the server to limit this. If you do this, that will be globally changed. This needs to be updated whenever the JIRA is upgraded.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 25, 2012

Third option is to write a plugin to provide your own custom-field-type - that would be similar to Jobin's option 2, but isolated from the other fields and a discrete package (you'd need to worry about upgrading it when Jira is upgraded, but it wouldn't be in the core of Jira)

hote January 5, 2016

Is there any possible to extend the length of number filed, such 20 bits?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 5, 2016

It already allows vastly more than 20 bits. I'm not sure what you're asking for here.

Suggest an answer

Log in or Sign up to answer