How to find out which dashboards are using a particular report

Renee Yu
Giga Contributor

Is there a way to find out which dashboards are using a particular report?  We want to clone a report and make a new version.  We need to know which dashboards are using the original report so that we could edit those dashboards and make them point to the new one.

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, I believe that you can see the report sys_id's in the 'sys_portal_preferences' records.

Unfortunately you can't run a report on the table OOB and there is no direct relationship to the Dashboard(s) ; So unless someone has a better solution you will either need to jump through a few hoops, consider making some changes for future ease of use, or knock up a quick script to do it for you.

Here's the manual solution.

Using the OOB Admin Console dashboard as an example we can trace the Report for 'Dashboard groups'

From 'Report Admin' get the sys_id of your report, our example is
'3c2fdce6c7100300b0ea8b3c5c976386'

From sys_portal_preferences query for the report sys_id in the 'Value' field
/sys_portal_preferences_list.do?sysparm_query=value%3D3c2fdce6c7100300b0ea8b3c5c976386&sysparm_view=

From each of the 'Portal sections' showing in sys_portal_preferences results (hopefully only 1 or 2)

Either
Drill into the Portal section and view the xml to get the 'Page' sys_id
or add 'Page' to the Portal form view and drill into each page to get it's sys_id

In our example we are looking at this Portal section
/sys_portal.do?sys_id=432f62e0c730030020508b3c5c976371

and the page sys_id we want is
'de4eaaa0c730030020508b3c5c9763a0'

From Dashboard Tabs list we can then find the Dashboard by drilling back through the Tab record to the page.sys_id

/pa_m2m_dashboard_tabs_list.do?sysparm_query=tab.page.sys_idSTARTSWITHde4eaaa0c730030020508b3c5c9763a0&sysparm_view=pa_tabs_lis

and in the Dashboard field of pa_m2m_dashboard_tabs
we finally have the name and a link to our dashboard 'Admin Console'

Thank you Tony! You made the following a lot easier to figure out;

Ui action on sys_report:

function showDashboards(){
	
	var ga = new GlideAjax('ReportAJAXUtil');
		ga.addParam('sysparm_name', 'getDashboardSysidsForReport');
		ga.addParam('sysparm_report_id', g_form.getUniqueValue());
		ga.getXML(createList);

	function createList(response) {
		var answer = response.responseXML.documentElement.getAttribute("answer");
		var w = new GlideDialogWindow('show_list');
			w.setTitle('Dashboards with this report');
			w.setPreference('table', 'pa_dashboards_list');
			w.setPreference('sysparm_view', 'default');
			w.setPreference('sysparm_query', "sys_idIN" + answer);
		w.render();
	}
}

Script include:

var ReportAJAXUtil = Class.create();
ReportAJAXUtil.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	
	getDashboardSysidsForReport:function(){
		var reportID = this.getParameter('sysparm_report_id');
		var sysIDs = [];
		var pageID = '';

		var grPP = new GlideRecord('sys_portal_preferences');
		grPP.addQuery('value', reportID);
		grPP.query();

		while(grPP.next()){
			pageID = grPP.portal_section.page.sys_id;

			var grDT = new GlideRecord("pa_m2m_dashboard_tabs");
			grDT.addEncodedQuery("tab.page.sys_idSTARTSWITH" + pageID);
			grDT.query();
			while(grDT.next()) {
				sysIDs.push(grDT.dashboard.sys_id);
			}
		}
		return sysIDs.toString();
	},
	
    type: 'ReportAJAXUtil'
});