Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-66947

Importing same sub-task from CSV with diferrent parent id would cause the sub-task to linked with multiple parents

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 7.8.0
    • Jira Importers Plugin

      Problem

      Importing a CSV with different parent id specified could result in association with multiple parents.

      Steps to reproduce the issue.

      1. Create a new project.
      2. Create two tasks, called it Parent 1 and Parent 2 respectively.
      3. Create two sub-tasks for Parent 1.
      4. In the issue navigator, search for all issues in the new project.
      5. Add Sub-Tasks as one of the columns and remove other columns.
      6. Export the result as CSV with current fields.
      7. The CSV file will look like the following.
        Issue Type,Issue key,Issue id,Parent id,Summary,Assignee,Reporter
        Sub-task,CSVI-4,10103,10100,Sub-task 2,,admin
        Sub-task,CSVI-3,10102,10100,Sub-task 1,,admin
        Task,CSVI-2,10101,,Parent 2,,admin
        Task,CSVI-1,10100,,Parent 1,,admin
        
      8. Edit the CSV file to change the parent id of Sub-task 2 from Parent 1 to Parent 2.
        Issue Type,Issue key,Issue id,Parent id,Summary,Assignee,Reporter
        Sub-task,CSVI-4,10103,10101,Sub-task 2,,admin
        Sub-task,CSVI-3,10102,10100,Sub-task 1,,admin
        Task,CSVI-2,10101,,Parent 2,,admin
        Task,CSVI-1,10100,,Parent 1,,admin
        
      9. Import the CSV file via Administration > System > External System Import > CSV.
      10. Map the values only for issue ID, issue type, issue key and summary.

      Expected result

      Sub-task 2 will be a sub-task of Parent 2 and only Parent 2.

      Actual result

      Sub-task 2 will be a sub-task of both Parent 1 and Parent 2.

      It's also associated to 2 parent tasks in the database.

      select i.id as "child_id", ( p.pkey || '-' || i.issuenum ) as "child_key", it.pname as "child_type", it.pstyle as "child_type_style", t.count as "number_of_parents", parent_i.id as "parent_id", ( parent_p.pkey || '-' || parent_i.issuenum ) as "parent_key", parent_it.pname as "parent_type" from jiraissue i join project p on i.project = p.id join issuetype it on i.issuetype = it.id join (select destination, count(*) from issuelink where linktype= (select id from issuelinktype where linkname = 'jira_subtask_link') group by destination having count(*) > 1) t on i.id = t.destination join issuelink parent_l on i.id = parent_l.destination join jiraissue parent_i on parent_l.source = parent_i.id join project parent_p on parent_p.id = parent_i.project join issuetype parent_it on parent_i.issuetype = parent_it.id where parent_l.linktype in (select id from issuelinktype where linkname = 'jira_subtask_link') order by child_id desc;
      

      Here's the result from the database.

      child_id child_key child_type child_type_style number_of_parents parent_id parent_key parent_type
      10103 CSVI-4 Sub-task jira_subtask 2 10101 CSVI-2 Task
      10103 CSVI-4 Sub-task jira_subtask 2 10100 CSVI-1 Task

      Workaround

      Use the Move Issue operation to change the parent to Parent 2. That way, the association with Parent 1 will be dismissed.

        1. search.png
          search.png
          17 kB
        2. multiple-parent.png
          multiple-parent.png
          45 kB

            Unassigned Unassigned
            michin Michelle Chin
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: