Duplicate dashboard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 07:06 AM
Hi all,
I'm trying to duplicate a dashboard but the new dashboard is still using reports from original dashboard. Is there a way by which we can duplicate a dashboard with duplicate reports. I thought of duplicating reports and creating a new dashboard all together but It is too much of manual steps.
Please feel free to share your thoughts
Thanks in advance 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 12:36 PM
Hi @Vedanti_ :
You can try something like this, I just created and you can give a try running a background script
var dashboard_sys_id = "sys_id of duplicated dashboard"; //sys_id of the duplicated dashboard [new];
var mapping = {
"61127d25770230107384c087cc5a99ad": "5942f165770230107384c087cc5a9963",
"5942f165770230107384c087cc5a9963": "61127d25770230107384c087cc5a99ad2"
}; //Here mapp the existing sys_id of the report and on the right side the new sys_id of your dashboard that you want to replace. You can write as much as you want
var dashboardTabsGR = new GlideRecord("pa_m2m_dashboard_tabs");
dashboardTabsGR.addQuery("dashboard", dashboard_sys_id);
dashboardTabsGR.query();
while (dashboardTabsGR.next()) {
var tabGR = new GlideRecord("pa_tabs");
tabGR.get(dashboardTabsGR.tab);
var pageGR = new GlideRecord("sys_portal_page");
pageGR.get(tabGR.page);
var portalGR = new GlideRecord("sys_portal");
portalGR.addQuery("page", pagrGR.sys_id);
portalGR.query();
while (portalGR.next()) {
var portalPreferencesGR = new GlideRecord("sys_portal_preferences");
portalPreferencesGR.addQuery("portal_section", portalGR.sys_id);
portalPreferencesGR.addQuery("name", "sys_id");
while (portalPreferencesGR.next()) {
if (mapping[portalPreferencesGR.value]) {
portalPreferencesGR.value = mapping[portalPreferencesGR.value];
portalPreferencesGR.update();
}
}
}
}
If I am correct it will replace the existing report with a sys_id of a new one that you want to replace in the dashboard with the same values.
Regards,
Marco