how to add multiple values/options to a custom field.

I have a custom field and i want to add near about 1000 values/option values to it. How can i do it in a bulk way? Is there any way to add it directly to database?

 

2 answers

1 votes

Doing it in the database is a very bad approach.  Do you fully understand the JIRA data structure well enough?  There's at least three tables you need to understand and that's just for global lists, there's more if you are using field contexts.

I'd also recommend that before you attempt this, you take a long hard look at the option list.  1,000 options is a silly amount to offer the users and probably isn't really usable.  You really need to look at what you're trying to do and probably change the approach.

If you do decide to do it, then:

The best way to do this is with a script with the script-runner add-on.  You can do a simple spreadsheet that can generate lines of script from a column with your values in it, paste it in and run it once.  Or, even better, use the built in Bulk import values script.

Another approach would be to create an empty project, and use CSV import to pull 1,000 issues into it, each with a dummy summary and a different option set, and tell the import to create new options.  Then delete the empty project (it won't remove the options, just the dummy issues you've created)

If you still want to do it with SQL, then you'll need a full understanding of customfield, customfieldoption, the counter table and the field's eventual context.  Also, you will need to plan for a full backup and JIRA being offline while the SQL runs, and a recommended full re-index after restarting it.

In db you have two tables:

customfield (here find your field id)

customfieldoption (add values to this field)

Argh, no.  You've forgotten the counters and the rest of the option flags.

Hi Michal,

do you have a scriptrunner example to adding option values to a custom field list using data from JIRA Db?

Thanks 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,897 views 12 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot