I need to convert a bunch of subtask to issues -- do not want to do this one by on.
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) } } } }
Use the bulk change tool.
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
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.
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.)
The ability to convert sub-tasks to issues is not possible via Bulk Change.
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.
Thanks for the confirmation.
@John, can you mark this the suggested answer so that other can follow this?
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
This worked perfectly for me when changing from sub-task to task
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?
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!
- 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.
It looks like you're new here. Sign in or register to get started.