Forum Discussion

Lisha's avatar
Lisha
Cloud Apps
10-04-2022
Solved

Dashboard Filter

Hi, I had a requirement to set my Dashboard date filter to have end date as today and this should be the default filter. (eg. 1 Jan 2022 to today) I found below script that does the job of settin...
  • harikm007's avatar
    10-04-2022

    Hi Lisha ,

    Try this script along with existing dashboard script.

    dashboard.on('filterschanged', function (se, ev) {
    
    	if(ev.items[0].jaql.title == 'As Of Month')
    	{
    		let today = new Date()
    		let todayParsed = parsedDate = today.toISOString().substr(0,10)
    	
    		ev.items[0].jaql.filter.to = todayParsed
    	
    	}
    });
    

    -Hari