logo

NJP

Get Reports which are not associated with any Dashboards

Import · Aug 10, 2024 · article

Run the below script to get all the reports that are not associated with any dashboard.

gs.info('Please find the below reports which are not associated with any dashboard');
gs.info('Report Title  --  Report on Table  --  SysID');
var grSysReport = new GlideRecord('sys_report');
grSysReport.addEncodedQuery("");
grSysReport.orderBy('null');
grSysReport.setLimit(100);
grSysReport.query();
while (grSysReport.next()) {
    var grSPP = new GlideRecord('sys_portal_preferences');
    grSPP.addEncodedQuery("name=sys_id^valueSTARTSWITH" + grSysReport.sys_id.toString());
    grSPP.orderBy('name');
    grSPP.query();
    if (!grSPP.hasNext()) {
        gs.info(grSysReport.title + '  --  ' + grSysReport.table + '  --  ' + grSysReport.sys_id); //
    }
}

Thank You,

Pradyumna Das

View original source

https://www.servicenow.com/community/developer-articles/get-reports-which-are-not-associated-with-any-dashboards/ta-p/3014864