CSV Importing of 'sub-tasks' and linking to existing 'Story'

I would like to import 'Story' and 'sub-task' from CSV to JIRA linking the sub-tasks to New or existing Stories (e.g. TEST-422)

The example I found in the documentation of a similar CSV is of:

Issue Id, Parent Id, Summary, Issue Type
 1, , Test, Story
 2, 1,ST For Test, Sub-Task
 3, 1,ST For Test, Sub-Task

 

But this cannot be used as I do not have the 'Issue ID' for the new or existing stories, only the 'Issue Key' or in some cases only the issue textual title (summary)

Would appreciate a simple example on how this could be done. 

5 answers

1 accepted

6 votes

You do need the Issue ID for subtasks - this is the one single unique identifier for the parent issue, and without using that, there's no reliable standard way to add subtasks to a parent.  Summary isn't good enough, it's perfectly possible to create issues with duplicate summaries.

So, there are two possibilities to talk about here.

  1.  You already have issues in JIRA, and want to create subtasks.  You need to add a column to your CSV that contains the issue ID of the parent - i.e TEST-422 (if you have a mix of sub-tasks and non-subtasks, you leave it blank for non-subtasks)
  2. Your data contains a mix of parent and sub-tasks to create

The second sounds like what you are trying to do, and it's a bit of a faff, although I can't see any more simple way to do it really.

Create TWO columns in your CSV.  Call one of them something like "Sequence" and the other "My Parent".  The sequence is effectively going to be a temporary unique id for JIRA to look at when trying to create subsequent subtasks, and the parent field is the thing to tie them together.

Taking your example (and repeating it a bit for hopefully improved clarity)

Your data is:

  • Issue-a
  • Subtask-a1
  • Subtask-a2
  • Issue-b
  • Subtask-b1
  • Subtask-b2

You need to create CSV

  • Sequence, My Parent, Summary
  • 001, ,Issue-a
  • 002, 001,Subtask-a1
  • 003, 001,Subtask-a2
  • 004, ,Issue-b
  • 005, 004,Subtask-b1
  • 006, 004,Subtask-b2

What JIRA does here is look at, but not import, the "Issue ID" column.  The column is there to provide a simple unique identifier in the csv, not in JIRA.

The second column says "I am a subtask, and I belong to the line in the CSV with the Issue ID of xxx".  Again, JIRA will not import it, it is just for tying subtask to parent during the import.

Note - I've always done this using a simple sequential number for "Issue ID" - spreadsheets can do a simple click and drag trick or use a formula for "cell above + 1" to generate the sequence.  Obviously, these need to be unique, but I don't really know that they have to be sequential.  Also, I think order matters - I've always ensured that a parent issue is higher in the CSV that any of it's subtasks.

Thank you Nic!

Your answer clarified very well to me how to add new Stories and Sub-Tasks together in a CSV (2)

Is there a way to do option (1) -  add sub-tasks to existing JIRA Stories?

Is there a way to get the Issue-ID to be added to the CSV? (maybe by using the Issue-Key?)

I have no problem adding this manually to the CSV after looking it up, just need to know how.

 

As I said for 1, use the existing issue ID

I am not sure I know how to get the it: The Issue-Key is the visible name that changes per JIRA DB (e.g. TEST-422) The issue-ID should a non-changing key ; where is it made visible for existing JIRA items (stories)?

Oh, sorry, I've used the phrases unclearly. The key (test-422) is the one you need to use in your csv. The issue-id (10255) is rarely exposed to the users directly and is not really made visible anywhere.

it's not working. I did exactly the same as you sampled.

doesn't work. The sub-tasks get created as orphans when trying to import to existing stories

Add sub-tasks to existing Story through .csv upload

Hi Everyone,

I seemed to have find a way to do it yesterday after many frustrating attempts.

When you create your .csv file, include a column with the Parent ID (The story you are trying to link your subtasks to) but also an Epic Link column (Here you will have the name of the Epic, the Story is linked to).

Please let me know if it works for you!

 

Guys,

I've just figured out that the value of Parent ID needs to be taken from External Issue ID of existing issue.

In other words, the Issue ID mentioned in documentation when importing issue and subtasks from CSV file is External Issue ID, not the id you will see in the issue 's url (it is internal ID)

Cheers!

 

 

Yes, that was in the original answer:

What JIRA does here is look at, but not import, the "Issue ID" column.  The column is there to provide a simple unique identifier in the csv, not in JIRA.

The second column says "I am a subtask, and I belong to the line in the CSV with the Issue ID of xxx".  Again, JIRA will not import it, it is just for tying subtask to parent during the import.

oh yes, for new issue with linking subtasks, it is as you have described. However, for existing issue, in case I need to import subtasks to that issue, I will need to use external issue ID

Hi Nic,

I have a common set of stories and tasks which are applicable for all projects. I need to add those stories and tasks in a project through .CSV file. Can you share with me the .csv format. I need to add tasks in Kanban board.

Thanx.

I tried Nic's solution for Scenario 2 but failed. I tried both "Epic & Story" and "Story & Sub-task" combination and neither succeeded. 

- In the "Mapping Fields" step, if I don't map "sequence" field and "My Parent' field, Jira just ignore them. (I am wondering how Jira can parse such two user-defined columns and link them smartly? The column names are not any of the Jira keywords. How does Jira know it needs to link them together?)

- If I mapping the 2 new fields to some existing fields such as "Issue ID" and "Parent ID", then I get an error message that the ID is invalid.

Am I doing something wrong?

Add sub-tasks to existing Story through .csv upload

Hi Everyone,

I seemed to have find a way to do it yesterday after many frustrating attempts.

When you create your .csv file, include a column with the Parent ID (The story you are trying to link your subtasks to) but also an Epic Link column (Here you will have the name of the Epic, the Story is linked to).

Please let me know if it works for you!

0 vote

Can you link stories and task together via CSV import? Issue type Story and task (not sub-task).

For anyone else reading this thread, Nic Brough's original post above works perfectly (contrary to some other comments in the thread). 

If you are trying to both add sub-tasks to existing stories and create new stories with new subtasks in the same import, I would suggest breaking your data up into 2 separate CSV files (one for each scenario) and doing 2 separate imports. That will simplify things quite a bit.  Follow Nic's instuctions above exactly as described for the 2 different scenarios and it will work perfectly.

To add subtasks to existing stories, this is all you need to do (Paraphrasing from above):

  1. Add a column to your sub-task CSV file that contains the issue ID of the parent (e.g. TEST-422)
  2. Leave the Issue ID column blank.
  3. Map the 'Parent ID' column you created to 'Parent ID' in the import template.
  4. Do your import

Thanks Nic!!!! You saved me a TON of time!

Hii Steven,

I'm getting the below error while importing the second sheet which consists of all the tasks with Parent-ID. Can you help me out please.

"You have to define which CSV column maps to Issue Id if you want to import sub-tasks."

 

Thanx for your support.

Hi M Shaikh,

I'm not sure I totally understand what you are doing with your second import, but if you want to import stories with subtasks, and do it in two steps as I suggested you will have to do the following,

1. Create a CSV file with all of the stories you want to create (No subtasks).

2. Import those stories into Jira. (At that point you can get the Issue ID's from your parent stories that are necessary for mapping your subtasks).

3. Create your CSV file with your subtasks identifying the parent story for each subtask by using the IDs you got above. 

Your subtask file columns should look like this

Issue ID | Parent ID | (The rest of your columns)
<Blank> | DEMO-1234 | (Additional column Data)
<Blank> | DEMO-1234 | (Additional column Data)

Each subtask associated with a given parent should have the same Parent ID.

4. Map Parent ID in your file to Issue ID on the import mapping screen.

5. Import your Subtask CSV file.

That should do it. Let me know if that answers your question, and works.

0 vote
Yang Yu I'm New Here Oct 17, 2017

Succeeded importing subtasks to existing issues. 

- you will need 2 separate columns 

a) issue id

- this is the sequential unique identifier (for the subtasks to be linked to existing issues) mentioned in previous post. 

b) parent id

- this is the 'issue key' for existing issues. I was confused by 'id' as I used the "issue id" (the unique number for an issue, start with 5 digit, you can get it by "Export Excel CSV (all fields)")

I am receiving following validation error

  • Subtask '<name of sub-task>' doesn't have a valid Parent Id selection. Issue will not be created.

Even though I have selected a valid parent id from CSV export and its a 6 digit number. Any other pointers ?

 

arun

Succeeded, 

mine worked with using the "Key" field (also used as Rank in ORDER BY function)

using the 5-6 digit Parent Id didn't work

Thank you!!! I had same issue... 

Not sure why Jira maps Parent ID with Issue Key... but finally works :)

Thank you Adriana. This is really helpful! I used Issue Key as Parent ID to import subtasks. It works!

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 ...

3,323 views 14 20
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