cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Introduction:
On the top panel of a dashboard you can see the date and time an ElastiCube was last updated. You can change the color of this text to green or red based on parameters using the script below. For instance, this script checks if the ElastiCube was refresh on today's date - if so make the text green, if not red.
Script: (add this to your Dashboard Script)
dashboard.on('refreshend', function(dashboard, ev){
 var all = document.getElementsByClassName('toolbar-dashboard-datasource__date');
 
 // Create date from input value
 var inputDate = new Date(all[0].innerText);

// Get today's date
 var todaysDate = new Date();

// call setHours to take the time out of the comparison
 if(inputDate.setHours(0,0,0,0) == todaysDate.setHours(0,0,0,0)) {
 
 for (var i = 0; i < all.length; i++) {
 all[i].style.color = 'green';
 }
 
 } else {
 
 for (var i = 0; i < all.length; i++) {
 all[i].style.color = 'red';
 }
 
 }
})
Rate this article:
Version history
Last update:
‎03-02-2023 09:24 AM
Updated by:
Contributors