Use SOQL to Identify Reports Used by Dashboard Components

Run a SOQL query to identify which dashboard components use a report that you’re trying to delete. Then reconcile them so you can proceed with the deletion. Requires the user permission “Manage All Private Reports and Dashboards.” Available in API version 37.0 and later.

Say that Sarah, after many years, has retired and left the company. As Salesforce admin, part of your job is removing the reports saved in Sarah’s private folder. Running a SOQL query using the allPrivate scope gives you access to Sarah’s private reports. But what if you can’t delete one report because it’s used by dashboard components? Previously, it was a challenge to identify which dashboard components used Sarah’s private reports. Now, a SOQL query does the trick.

First, run a SOQL query on the DashboardComponent sObject. In this example, the report with the Id 00OR0000000PBZZMA4 is a report saved in Sarah’s private folder.

SELECT Id, DashboardId, CustomReportId FROM DashboardComponent USING SCOPE allPrivate WHERE CustomReportId = ‘00OR0000000PBZZMA4’

The query returns a list of dashboard components that use Sarah’s private report as a source. With this list in hand, you can quickly account for the report’s associated dashboard components and then delete the report.