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

Automatic delete rapid boards in Jira

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.
May 23, 2019

What is it for?

Working with large instances of Jira is one of the problems; it’s a lot of different things. One of them is rapid boards. Unfortunately, Jira has no tools to find the orphaned boards and remove them. In the previous post, I tried to find part of the orphan boards. In the current post I am trying to remove them from Jira.

I use GEB to remove them through the user interface.

"Why not just delete them directly from the database or buy a plugin?"

Yes, this is an easy way, but there are some drawbacks:

  1. Needed stop Jira (if operate DB)
  2. You should have access to DB for update/delete operations. (For me security politics deny direct access to DB, but I have, shh)
  3. I am afraid to do something directly in the database, excluding the selection operations, because it is easy to break the system
  4. To buy some plug-in needed money, and for big Jira, big money was needed
  5. Also, the use of the plug-in can affect system performance

For balance I write drawbacks of the my scripts:

  1. Needed to know the groovy
  2. It has middle speed. Because UI not very fast for delete one board needed up to 5 sec. If we want delete 1000 boards it will be doing 1.5 hours
  3. High sensitive for change UI. If in new jira version rename some class the script will not work
  4. We cannot delete restricted boards (I'm working on this problem)

About code

Look at the method in more detail:

public static void delBoards(fName){

We check the file 'fName' and extract list boards from them.

Open 'manage boards':

browser.go url + "/secure/ManageRapidViews.jspa"

The first problem is the pages on the board. Looks like we can go through all the pages to create a list of boards. Then simply remove the board from the desired page. No, unfortunately, after removing boards, the number of pages may decrease, and the position of boards has changed. This means that we have to check page after page and start again after deletion. (It may be better to start from the page where the last board has been deleted, but, I'm afraid, Jira may re-sort boards)

Well, check, we have many pages:

if (browser.$("li", class:"aui-nav-next").displayed)

Scan the current page and get all the current boards:


Check each current board to remove:

currentBoards.each {

More details about:

 if (!removed||!hasPage){ 

So if we delete one board, we will start again, because Jira has reloaded the page and GEB has lost the item. We need to re-scan, but if we only have one page, we don’t have to start over, because GEB has not lost the elements.

If we find the current board in the file, we need to delete them:

 if (boards.find {it == curB}){

The next problem we will discover is that Djira has no direct link to remove the board. It mean we need 'click' a few button for delete board. Write new method 'delBoard' for this, we use only board id:

if (this.delBoard(it)){

This method just click on button with ID '...' -> 'Delete' -> 'Delete'.

If the board has been removed and we have many pages, we start again.

 public static boolean delBoard(bId)

If we didn’t find any boards to delete on the current page, we need to click on the next page.

if (!removed&&hasPage){

Finally, if we stay on the last page and cannot find a board for removal, it means that we checked all the boards.

 if (lastPage&&!removed){

Flowchart of the method delBoards:


Untitled Diagram.png

How it work?

Use groovy and geckodriver . Run in CMD 'grooby JiraGebAuto.groovy delBoards list.txt' File 'list.txt' should exist at the same dir where 'JiraGebAuto.groovy' Script run browser and write deleted id in file 'deletedBoards.txt'. list.txt should have only id of the boards separate with new lines.



Warning! Please be very careful. The script has a method for deleting projects, I recommend commenting on these methods and using only if You know groovy. Check everything twice.

I hope this post was helpful.




Log in or Sign up to comment
AUG Leaders

Atlassian Community Events