how would i create a custom field that stores both Text and Numbers

My Custom (numeric) Field, "Change ID" now needs to store text as well as numbers. I don't believe i can change the currentl logic and was therefore going to create a new custom field. However, I'm not seeing within the current list of Cumstom Fields in JIRA 6.2 where this fuctionality is available. Please advise.

3 answers

0 votes

You need to create a custom field *type* in a plugin.

Numeric field is one type of custom field, as is text, select, multi-select and so-on. You need to write a plugin that will provide "number or text" type field

However, the mixed data type really isn't supported in Jira's back end - it kind of expects you to have one type of data, so you can't really use the standard API calls, you'll need to write your own. Or just store the information as a string irrespective of type.

Or, just use a string, as that can store numbers or text already.

I've just thought again.

You've got a compounded problem here. Whether you swap to a simple text field or write a new field, you are not going to be able to change the type of the existing field. You can add a new field of the new type, but you'll need to migrate your data into it.

You can change field types in the database, if you are very very careful (proven backups, Jira offline, reindexing afterwards), but this could be a bit of a trek because number fields are stored in one way and moving to a string or whatever structure you write is probably going to require data migration.

0 votes
Mizan Community Champion Apr 24, 2014

You can create a text type customfield and add a javascript validation to the field which will allow only alphanumeric entries.You can do this by adding the javascript in the field description

What about the existing values in the customfield ? you will need to migrate those values to the new customfield. refer this doc

0 votes
That would mean the field would no longer accept text. It would be safer and easier to just use a numeric field.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

23,213 views 2 7
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