Hi @All here !!
How get part of orphaned boards
Groovy script for ScriptRunner which help retrieve a list of orphaned boards.
What mean orphaned boards?
After deleting old projects in the boards panel, we can find all the boards of the deleted projects. This means that the boards no longer affect the project and are not needed by us.
A warning! In some cases, the board uses mixed filters, and after deleting one project, it can work in another project.
In this script, I am trying to find the part of the board that was used only for one project and check that this project does not exist.
How find orphaned boards?
The boards use a filter and in the database exist table 'AO_60DB71_RAPIDVIEW' where board point to the filter. Filter we can find in table 'searchrequest'.
Working with a mixed filter is more difficult, and first we try to get simple filters. For that using regex in SQL request '.*project ='.
Summary we give next:
SELECT r.ID, s.reqcontent FROM AO_60DB71_RAPIDVIEW as r inner join searchrequest as s on r.saved_filter_id = s.id where s.reqcontent regexp '.*project =';
In this request we can get mixed projects. For example JQL: 'status = OPEN OR project = DEMO'. I just remove all filters with 'AND' and 'OR' statements.
For these using regex in groovy:
if (it.reqcontent ==~ /^((?!\sAND\s|\sand\s|\sOR\s|\sor\s).)*$/)
In next step we need get project key or name. For that we split string on word 'ORDER' and remove quotes.
def bufStr = it.reqcontent.split('=').split('ORDER')
projName = bufStr.replaceAll(/"/, "").trim()
Then we get lists of the projects name and keys.
select pname from project;
select PROJECT_KEY from project_key;
Finally we check the ours project is exist. If not exist that mean the board is orphaned.
Now we can put all this in the script console and try to get a list of orphaned boards.
I hope this post was helpful.
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