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

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 vote

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.

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)

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

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

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>

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

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

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

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.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

689 views 6 13
Read article

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