Import Data into Labels Field

Julio Ochoa February 9, 2015

I'm trying to populate a custom Label field in one of my projects with about 200 values. The list contains information about the systems in this project, hence the lengthy list.

I tried it with JSON following the suggestions here:

https://confluence.atlassian.com/pages/viewpage.action?pageId=314449019

and here:

https://confluence.atlassian.com/display/JIRA/Importing+Data+from+JSON#ImportingDatafromJSON-CustomFields

But my imports keep failing. It looks as if the import is expecting a Summary field. The JSON format does indeed include the "customFieldValues" section inside the "Issues" section. It's as if it's trying to import a issues and populate them with the Labels.

I need to do the opposite. That is, I need to pre-populate the Labels field so that when users start entering issues, the values are already there.

I also tried importing the list using CSV, but again a summary field is required.

Is there any way to pre-populate the Labels field so that when users start entering issues, the values are already there?

I don't think creating 200 bogus issues and deleting them is a practical approach.

 

FWIW, here are he JSON imports I tried:

Attempt 1:

{

 

    "projects": [

        {

            "key": "TPHELP",

            "issues": [

                {

                    "customFieldValues": [

                        {

                            "fieldName": "Service Tag",

                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:labels",

                            "value": "1FM3PC1"

                        },

                        {

                            "fieldName": "Service Tag",

                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:labels",

                            "value": "1GRBQW1"

                        },

                        {

                            "fieldName": "Service Tag",

                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:labels",

                            "value": "1GS8QW1"

                        }

                    ]                   

                }

            ]

        }

    ]

}

 

Attempt 2:

"customFieldValues": [

                        {

                            "fieldName": "Service Tag",

                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:labels",

                            "value": "1FM3PC1"

                        },

                        {

                            "fieldName": "Service Tag",

                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:labels",

                            "value": "1GRBQW1"

                        },

                        {

                            "fieldName": "Service Tag",

                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:labels",

                            "value": "1GS8QW1"

                        }

]

 

3 answers

1 vote
Ert Dredge December 18, 2016

I interpreted this question as "I want the auto-complete in the labels field to already guide my users to one of about 200 existing entries."  I actually had a custom label-style field called "Customer" and had a similar need.

My goal was to create a single "dummy" issue that had all the customers on it, so that any subsequent time someone creates an issue the typeahead assists with the names of the actual customers and I don't get my users making up their own abbreviations.

If you use CSV import, with a column for each customer, it works.  So my file looks something like:

 

Issue Type,Summary,Custom field (Customer),Custom field (Customer),Custom field (Customer)
Task,Dummy issue,Acme-Products,Baker-Manufacturing,Canadian-Government

 

...then use the CSV importer and it will allow you to map that field to my Customer field, and I get a single issue with all my customers in it.

 

0 votes
Julio Ochoa February 11, 2015

Nic, thanks for the response. I hope I'm not interpreting your statement that the importers only import issues. The importers also import users, projects, and specific values for projects. I've used JSON importers to import the components for a specific project for example. Your reference may have been specifically within the context of issues, but I wanted to clarify in case it helps someone else.

In my case, I ended up copying and pasting the values into the Label field of a test issue that I had in this project. Fortunately this field type allows for multi-value entries and you can just copy and paste. So even with a few hundred labels, I was able to just copy and paste.

 

0 votes
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.
February 9, 2015

That is not how the labels field works - it does not have a pre-set list of options, its suggestions are based on what users have previously added.  In other words, you have to have some issues with your desired labels already added before it can start to make any suggestions.  The importers only import issues.

Suggest an answer

Log in or Sign up to answer