Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the filters which are used in the board

Abhijeet Kale October 29, 2023

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?

2 answers

1 accepted

3 votes
Answer accepted
Ravina
Community Champion
October 29, 2023

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

Abhijeet Kale October 29, 2023

Thanks @Ravina that help.

0 votes
Oussama Brik April 30, 2025

If you have scriptrunner:

// Import all necessary libraries, part of the template

import com.atlassian.jira.component.ComponentAccessor

import org.ofbiz.core.entity.ConnectionFactory

import org.ofbiz.core.entity.DelegatorInterface

import java.sql.Connection

import groovy.sql.Sql

// Get the delegator component to access the database

def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface)

// Retrieve the database helper name

String helperName = delegator.getGroupHelperName("default")

// SQL query to fetch board and filter details

def 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 connection

Connection 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()

}

Suggest an answer

Log in or Sign up to answer