Skip to content

Instantly share code, notes, and snippets.

@zionyx

zionyx/README.md

Last active May 14, 2020
Embed
What would you like to do?
JavaScript to delete all inactive workflows in JIRA

@jetersen developed this awesome javascript to delete all deletable, inactive workflows in JIRA.

Steps:

  1. As admin, go to https://jira/secure/admin/workflows/ListWorkflows.jspa
  2. Open developer console in your browser, copy paste the js below and run it.

⚠️ Note

It may crash your browser, but not JIRA.

Tested on our instance:

  • Removed 125++ inactive workflows
  • Via Google Chrome 74.0.3729.131
  • On JIRA 7.10.2
deleteElements = document.querySelectorAll(
"#inactive-workflows-table td a[data-operation='delete']"
);
options = {
method: "post",
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
}
};
deleteElements.forEach(element => {
href = element.href;
if (href) {
href = href.toString() + "&confirmedDelete=true";
const [url, data] = href.split("?");
const workflowName = data.split("&")[2];
options.body = data;
fetch(url, options)
.then(response => {
if (response) {
console.log(`${workflowName} removed: ${response.status}`);
}
})
.catch(error => {
console.log(`FAILED to remove ${workflowName}`);
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.