CSV import parent/child relation

Denis Corlier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2024

I've created an Epic and now based on a CSV file i want to create a huge set of stories that are all having 2 sub tasks. How do i make my csv so that the sub tasks are linked to the stories 

 

So fat i'm able to create the stories inside the epic using the epic link field but i'm not able to add the Sub-Tasks inside the stories.

Here s a sample of my csv file:
Type;IssueID;Summary;ParentID;Timeoriginalestimate;EpicLink;Component
Story;1;Test Story;;;xxxV2-33604;xxx
Sub-Task;;Sub-Task 1;1;10800;;
Sub-Task;;sub-Task 2;1;10800;;

In the CSV for the Story i've set the value 1 that i map to 'Issue Id' and for the Sub-Tasks i'm setting the value of ParentID that i map to 'Parent Id' to the ParentID of the Story.

When i try to validate the import the creation of the story is validated but i'm receiving the following error messages:

  • Subtask 'Sub-Task 1' doesn't have a valid Parent Id selection. Issue will not be created.
  • Subtask 'Sub-Task 2' doesn't have a valid Parent Id selection. Issue will not be created.

So my question is how do i define the parent/child relationship between my Stories and Sub-Tasks inside the CSV file ?

Should i do it in 2 steps ? First create all the Stories and the get all the stories ids and create the sub tasks ? 

Thanks for the help

3 answers

1 accepted

3 votes
Answer accepted
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2024

Hi @Denis Corlier 

All rows need an Issue ID, so ensure Sub-tasks have them also. And all IDs should be unique.

---

The setup should then be like this (which it might already be):

Issue Type   Issue ID  Parent ID  Summary
 Task  1    Task 1
 Sub-task  2  Sub-task 1
 Sub-task  3 1 Sub-task 2

 

Ste

Denis Corlier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 29, 2024

i've just tested and it works ! Thanks a lot !

Like # people like this
Carlos Segovia July 6, 2024

its not work for me, only works when i imported from /secure/admin/ExternalImport1.jspa

but this will not be abailable soon

 

if i tried imported from project its not work, this is the message :

The validation process has found 1 error/s

  • Issue 'Descripción del Distrito Innovación' doesn't have a valid Parent selection. Issue will not be created.
0 votes
Karen
Contributor
October 17, 2024

Finally solved!!  Here is the PowerShell script.. Hope it helps you.

Make sure your CSV file has the two columns called Parent and Key (see below)

 

$JiraConfigServer = <your URL>

$InputFile = <Your file>

$Email = <Your email>

$APItoken = Your API Token>

 

$Token = ConvertTo-SecureString $APItoken -AsPlainText -Force

$Cred = New-Object System.Management.Automation.PSCredential ($Email, $Token)

$JiraConfig = Set-JiraConfigServer -Server $JiraConfigServer

$JiraSession = New-JiraSession -Credential $Cred

$EpicFeatureTaskData = Import-Csv -Path $InputFile

$Counter = 0

ForEach ($Task IN $EpicFeatureTaskData)

{

    $Fields = $null

    $Fields = @{

        fields = @{

            parent = @{key = $Task.Parent}

        }

    }

    $Body = $null

    $Body = $Fields | ConvertTo-Json

    $URI = $null

    $URI = "$(Get-JiraConfigServer)/rest/api/latest/issue/" + $Task.Key

    

     Params = $null

    $Params = @{

        Uri = $URI

        Method = "PUT"

        Body = $Body

        Credential = $Cred

    }

 

     $Results = $null

    $Results = Invoke-JiraMethod @Params

    Write-Host "`Task now points to:" $Task.Parent

    Write-Host

 

    $Counter ++

}

Write-Host

Write-Host "Total tasks processed:" $Counter

Write-Host

Write-Host "Done with Jira updates!"

Write-Host

Jim Woodward
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 6, 2024

This isn't really an answer, is it? The issue is we're getting an error on Validation as: "...doesn't have a valid Parent selection. Issue will not be created."

Obviously you'll know the answer on how to resolve this issue but I'm unable to deduce it from your file though. Can you show in a csv string?

 

0 votes
Joshua Dickerson
Contributor
September 27, 2024

How does this work when the Parent:

a- Exists already

b- is in a different project

 

Thanks!

Karen
Contributor
October 12, 2024

Hi @Joshua Dickerson .  Did you ever figure this out?  I'm running into the same problem.  I cannot update parent link (which is in a separate project) using the "External System Import".  It cannot find it.  However, if I use the import issues in the project it will import the Task and link.  This would work if I did not need to keep the Task key the same..  

Joshua Dickerson
Contributor
October 14, 2024

Hello @Karen ! I have not figured this out; nor have I received any feedback from any community. Hopefully we will hear something from Atlassian.

Karen
Contributor
October 17, 2024

@Joshua Dickerson .  I posted the solve I used.  Good Luck!

Suggest an answer

Log in or Sign up to answer