Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a way to en mass convert subtask to issues

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

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)
            }
        }
  }  }

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

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.

 

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

Like piotr.janecki likes this

Thanks for the confirmation. 

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

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

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

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.

It tells me that the issue type is invalid :|

Like jbz likes this

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

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!

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

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

Like jbz likes this

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

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.

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you