Is there a way to en mass convert subtask to issues

John Geasa February 23, 2012

I need to convert a bunch of subtask to issues -- do not want to do this one by on.

7 answers

1 accepted

0 votes
Answer accepted
Logan G Hawkes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2012

Sadly, there's no way to do it automagically using the Jira UI, the Jira Scripting Suite, SOAP, or REST. The only way to move subtasks to issues is one-at-a-time via the GUI. That said, there's a way to make the process less painful. You can use Selenium and HTMLUnit to drive the browser through the steps necessary to move the issues. Here's a big chunk of code to get you started.

import org.junit.Test
import org.openqa.selenium.chrome.ChromeDriver
import java.util.concurrent.TimeUnit
import org.openqa.selenium.ie.InternetExplorerDriver
import com.gargoylesoftware.htmlunit.WebClient
import com.gargoylesoftware.htmlunit.html.HtmlPage
import com.gargoylesoftware.htmlunit.BrowserVersion
import org.openqa.selenium.By
import org.openqa.selenium.firefox.FirefoxDriver

class migrateme {
    public static FirefoxDriver Driver

    public static void main(String [] args){

        Driver = new FirefoxDriver()

        //Driver = new InternetExplorerDriver()
        Driver.get("http://<SERVERNAME>/browse/<PROJECTKEY>")
        Driver.manage().timeouts().implicitlyWait(120,TimeUnit.SECONDS)

        Driver.findElement(By.name("os_username")).sendKeys("<USERNAME>")
        Driver.findElement(By.name("os_password")).sendKeys("<PASSWORD>")
        Driver.findElement(By.name("login")).click()


        File list = new File(args[0])
        File errors = new File("errors.txt")
        list.eachLine {
            println it
            def tcName = it.tokenize(",")[1]
            if (it.startsWith("id")) return
            println tcName

            try{
                Driver.get("http://<SERVERNAME>/browse/$tcName")

                def UserStory = Driver.findElement(By.id("parent_issue_summary")).getAttribute("href")
                UserStory = UserStory.tokenize("/")[-1]

                Driver.findElement(By.id("opsbar-operations_more")).click()
                Driver.findElement(By.id("subtask-to-issue")).click()

                Driver.findElement(By.xpath("//option[@value='11']")).click()

                Driver.findElement(By.id("next_submit")).click()
                sleep((4000))
                Driver.findElement(By.id("next_submit")).click()
                sleep(2000)
                Driver.findElement(By.id("finish_submit")).click()
                Driver.findElement(By.id("opsbar-operations_more")).click()
                Driver.findElement(By.id("link-issue")).click()
                Driver.findElement(By.xpath("//option[@value='is a test for']")).click()
                Driver.findElement(By.id("linkKey-textarea")).sendKeys(UserStory)
                Driver.findElement(By.id("issue-link-submit")).click()
                sleep(3000)
            }
            catch (Exception ex){

                println "ERROR: $tcName was not migrated $ex.message"
                errors.append(tcName)
            }
        }
  }  }

Lee Correll
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2012

Does this still work? I tried to fire up Selenium to do some transition steps, but was stymied by the continually changing nature of AJAX and the UI (I think.)

4 votes
Deleted user July 21, 2016

Hi,

We manged to do this by the below mentioned steps:

1. Prepare the CSV with only issue with Key, Summary and Issuetype fields.
2. Import the issue using CSV import. Please refer to the below link if you are not across:

https://confluence.atlassian.com/adminjiraserver071/importing-data-from-csv-802592885.html

3. You have to check the 'Map field value' field in 'Map fields' screen for the 'issue type' field.
4. Map the subtasks to the parent issue types.

Regards,
Auro.

 

Jim Hume October 31, 2016

Confirmed. Had to do this just now and your answer solved my problem. Thank you.

Like piotr.janecki likes this
Murty Chitti November 1, 2016

Thanks for the confirmation. 

@John, can you mark this the suggested answer so that other can follow this?

Bhumika Parikh March 30, 2021

for step3 above, what do we select in the "Jira Field"?  Parent issue type is not an option.

Also, regardless of what I select, it doesn't allow me to click "Next" any suggestions?Screen Shot 2021-03-30 at 10.48.27 AM.png

Chris Beck March 30, 2021

I would follow Shelli's answer (circa Mar 28, 2019) below

3 votes
Shelli March 28, 2019

At least starting in version 7.13 (not sure when it was introduced) you can covnert sub-tasks to issues via the "Bulk Change" tool.  Select the "Move" option.

Mike Hermansen June 20, 2019

It tells me that the issue type is invalid :|

Like jbz likes this
Chris Beck March 29, 2021

This worked perfectly for me when changing from sub-task to task

arieli April 4, 2021

do you know how I can maintain the sub- task connection to it's parent task? meaning, I did a story - bug (sub-task) that is a sub-task of story, now I want to convert all story-bugs to regular bugs, can I change the connection so the bugs will be link to the stories?

thanks!

Shelli May 10, 2021

@arieli  Not that I'm aware of in the same step.  You can do another bulk update on the converted tasks adding the parent link.  That's what I do.

1 vote
Logan G Hawkes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2012

Use the bulk change tool.

Frank Vidal September 11, 2014

The ability to convert sub-tasks to issues is not possible via Bulk Change.

Like jbz likes this
0 votes
Brad Johnson May 10, 2021

- Do an "advanced search" in Jira (`/issues/` URL)

- Under the filters, choose to "add" a new filter and select "Parent" from the list of options

- Enter your sub-tasks' parent ID as the filter value, this will produce a result set of all your sub-tasks

- In the top right of the UI, click on the menu icon and choose "bulk update all # issues"

- Choose Move

- Change the type from "sub-task" to "task", etc.

0 votes
Lee Correll
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 23, 2012

I'm not sure you can use the JIRA CLI - if you dump the issues, they're still there - if you add them back, they'd have different issue numbers, and then you'd just have duplicate issues.

0 votes
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 13, 2012

Or use JIRA command line interface. Dump the issues using a filter, do a bit of scripting and add them back as JIRA issues.

https://bobswift.atlassian.net/wiki/display/JCLI/JIRA+Command+Line+Interface

Suggest an answer

Log in or Sign up to answer