cancel
Showing results for 
Search instead for 
Did you mean: 
Community_Admin
Community Team Member
Community Team Member
In this post you can learn how to automatically 'Restore Dashboard' on each page refresh or opening, this setting will always restore the dashboards initial published state for your viewers and designers.
 
This can be used for cases where you would like to keep things simple for your dashboard users, removing previous selections and filter changes. This can also help some of your less technical dashboard users to stay organized and assure they are receiving the correct information when loading the report.
 
In order to do so, please paste the following script into the dashboards script:
dashboard.on('initialized', function(se, ev){ 
if (localStorage.getItem('toRefreshPage') == 'true') 
{ 
if (prism.user.roleName != 'super' && window.navigator.userAgent.indexOf('phantom') == -1) 
{ 
var dashid = '55e45211ecb61bf493000131', 
$state = prism.$injector.get('$state'); 

localStorage.setItem('toRefreshPage', "false"); 

prism.activeDashboard.$dashboard.restoreSharedDashboard(dashid).then(function(dash){ 
$state.go('layout.shell.dashboard', { 
dashboardid: dashid, 
ref: $$guid_fast(4) 
}); 
}); 
} 
} 
else 
{ 
localStorage.setItem('toRefreshPage', 'true'); 
} 

});

Note: The Dashboard ID '55e45211ecb61bf493000131' is just an example, please change it to the relevant dashboard ID you would like to use this script with.

 
 
Rate this article:
Comments
Ryan
7 - Data Storage
7 - Data Storage

Howdy.  This is the EXACT functionality we're trying to implement, but we cannot seem to get this script to work.  We've changed the dashboard ID, etc.

It's worth noting that the 'Restore Dashboard' option in the viewers dropdown DOES work/does exactly what we're looking for...

 

Ryan_0-1644350309744.png

Any advice is MUCH appreciated.

ebambury
8 - Cloud Apps
8 - Cloud Apps

Warning: I added this script to my dashboard and all widgets were erased. The dashboard returned to it's initial "empty" state and I lost all of my work.

ssoltz
8 - Cloud Apps
8 - Cloud Apps

I had the same result as @ebambury 

Anyone have any solutions to this?

We definitely need this functionality!

Version history
Last update:
‎10-17-2021 04:57 AM
Updated by:
Contributors