Created
April 9, 2013 21:43
-
-
Save robertpateii/5349669 to your computer and use it in GitHub Desktop.
We use JIRA at work for bug tracking. There is no way currently to convert "Tasks" in bulk to "Sub-Tasks." I needed to convert about 30 tickets, so I wrote some JavaScript I could just copy/paste into the browser console on each page load. Saving it here in case this happens again.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertToSubTask (taskID) { | |
"use strict"; | |
// Returns are required otherwise the rest of the if statements will attempt to execute. | |
// A switch statement would be easier to read and maintain. | |
// taskID must be a string. | |
if (jQuery("#issue-to-subtask").length > 0) { | |
window.open(jQuery("#issue-to-subtask").attr("href"), "_self"); | |
return true; | |
} | |
if (/ConvertIssue\.jspa/i.test(window.location.href)) { | |
jQuery("#parentIssueKey").attr("value",taskID); | |
jQuery("#next_submit").click(); | |
return true; | |
} | |
if (/ConvertIssueSetIssueType\.jspa/i.test(window.location.href)) { | |
jQuery("#next_submit").click(); | |
return true; | |
} | |
if (/ConvertIssueUpdateFields\.jspa/i.test(window.location.href)) { | |
jQuery("#finish_submit").click(); | |
return true; | |
} | |
if (jQuery("#issue-to-subtask").length === 0) { | |
window.open('', '_self', ''); | |
window.close(); | |
return true; | |
} | |
} | |
jQuery(convertToSubTask("MKT-8603")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment