Knowledge Base Article
Sorry, one last question: how would I use this to set multiple date filters? I was originally using it to automatically set the filter for an "Open Date", but I just realized I need to do the same for a "Closed Date" filter as well (they apply to different widgets, and I'm turning on/off the appropriate dashboard-level filter from within each widget as necessary).
Is it okay to just copy/paste the entire script again, with the filter name variable modified for the second one, so there's two sets of the script running one after the other? Like so:
dashboard.on('initialized', function () {
let filterModifiedName = "Opened Date";
//...rest of the code for setting "Opened Date"...
});
dashboard.on('initialized', function () {
let filterModifiedName = "Closed Date";
//...rest of the code for setting "Closed Date"...
});
Would this cause issues? Or, perhaps, is there a better way to implement this? I assume it'll be different if you're setting all the filters to the same values (e.g. both are set to 1st of the year through today) vs setting each to something different (e.g. Opened is 1st of the year through today but Closed is 1st of the quarter through today).