We are working on the Jira data clean up and wanted to delete the filters which are used in any boards so that we can communicate to those filter owners and delete the same.
Is there any easy way to get that filters list?
Hi @Abhijeet Kale The below old community post is having similar details about the SQL query to find out the filters which are used in the boards and there is also sql query to find the filters which used in Dashboards gadgets as some filters are used in the Dashboard gadget as well and you need to check them as well before deleting any filter from the Jira
https://community.atlassian.com/t5/Jira-questions/Query-or-ways-to-find-filters-which-linked-with-any-dashboard-or/qaq-p/1064874
Thanks
Ravina
Thanks @Ravina that help.
If you have scriptrunner:
// Import all necessary libraries, part of the templateimport com.atlassian.jira.component.ComponentAccessorimport org.ofbiz.core.entity.ConnectionFactoryimport org.ofbiz.core.entity.DelegatorInterfaceimport java.sql.Connectionimport groovy.sql.Sql// Get the delegator component to access the databasedef delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface)// Retrieve the database helper nameString helperName = delegator.getGroupHelperName("default")// SQL query to fetch board and filter detailsdef sqlStmt = """ SELECT "AO_60DB71_RAPIDVIEW"."ID" AS "Board ID", "AO_60DB71_RAPIDVIEW"."NAME" AS "Board Name", "AO_60DB71_RAPIDVIEW".OWNER_USER_NAME AS "Board Owner", sr.filtername AS "Filter Name", sr.authorname AS "Filter Author Username", sr.reqcontent AS "Filter JQL", sr.FAV_COUNT AS "Filter Fav. Count" FROM searchrequest sr JOIN "AO_60DB71_RAPIDVIEW" ON "AO_60DB71_RAPIDVIEW"."SAVED_FILTER_ID" = sr.id"""// Establish a database connectionConnection conn = ConnectionFactory.getConnection(helperName)Sql sql = new Sql(conn)try { // Build the HTML output for the table StringBuffer htmlOutput = new StringBuffer() // Start table creation with styles htmlOutput.append("<table border='1' style='border-collapse:collapse;width:100%;'>") htmlOutput.append("<thead>") htmlOutput.append("<tr>") htmlOutput.append("<th>Board ID</th>") htmlOutput.append("<th>Board Name</th>") htmlOutput.append("<th>Board Owner</th>") htmlOutput.append("<th>Filter Name</th>") htmlOutput.append("<th>Filter Author Username</th>") htmlOutput.append("<th>Filter JQL</th>") htmlOutput.append("<th>Filter Fav. Count</th>") htmlOutput.append("</tr>") htmlOutput.append("</thead>") htmlOutput.append("<tbody>") // Fill the table with rows from the SQL query results sql.eachRow(sqlStmt) { row -> htmlOutput.append("<tr>") htmlOutput.append("<td>").append(row.getAt("Board ID")).append("</td>") htmlOutput.append("<td>").append(row.getAt("Board Name")).append("</td>") htmlOutput.append("<td>").append(row.getAt("Board Owner")).append("</td>") htmlOutput.append("<td>").append(row.getAt("Filter Name")).append("</td>") htmlOutput.append("<td>").append(row.getAt("Filter Author Username")).append("</td>") htmlOutput.append("<td>").append(row.getAt("Filter JQL")).append("</td>") htmlOutput.append("<td>").append(row.getAt("Filter Fav. Count")).append("</td>") htmlOutput.append("</tr>") } htmlOutput.append("</tbody>") htmlOutput.append("</table>") // Return the generated HTML table (can be displayed via a custom interface) return htmlOutput.toString()} finally { // Ensure the database connection is closed sql.close()}
It looks like you're new here. Sign in or register to get started.