How to auto-refresh custom heatmap widget on dashboard without manual reload?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12 hours ago
Hi everyone,
I’ve built a custom heatmap for a dashboard using a client script + Script Include. The data is pulled via a GlideAjax call and then rendered into a heatmap table.
Currently, the heatmap only loads when I manually refresh the dashboard.
Here the ui widget that i use to load the ui page to to the widget:
Here’s a simplified version of my client script :
...... } catch (e) { // handle error } });
And the Script Include just aggregates some table data, groups it by two fields, and returns a JSON object.
Question:
What’s the best way to automatically reload or auto-refresh this heatmap data on the dashboard at a set interval (say every 30 seconds or 1 minute) without requiring a manual page refresh?
I want the dashboard to show the latest data continuously, but I’m not sure of the cleanest approach in ServiceNow (interval timers, using $scope.$broadcast, or another pattern).
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12 hours ago
Hi @vkolokythas ,
To display the latest data continuously, you have a few options:
If you’re building the dashboard in Service Portal, use spUtil.recordWatch to auto-refresh the widget when underlying data changes.
Alternatively, consider using a Workspace instead of a dashboard, as Workspaces natively handle auto-refresh.
You can also explore the Dashboard Auto Refresh Widget available on the Developer site.
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.