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 vote

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 vote
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 vote
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
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 Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

112 views 0 5
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