Sub topic 10
Refreshing, scheduling and subscribing
This chapter assumes you can build a dashboard, set its running user, and know what a dynamic dashboard is. Here you will learn how dashboard data stays current and how to choose between the three refresh options.
How dashboard data goes stale
A dashboard does not query live data each time someone opens it. It shows the results from its last refresh, and the "As of" timestamp in the dashboard header tells you when that was. Each component reads from a source report, so a refresh re-runs those reports and redraws the components.
The running user decides whose data is used in the refresh. A refresh always runs with that user's record access, as covered in the running user chapter.
The three options
| Option | Who triggers it | Whose data | Best for |
|---|---|---|---|
| Manual refresh | The viewer, with the Refresh button | Running user (static) or the viewer (dynamic) | Ad hoc checks, dynamic dashboards |
| Scheduled refresh | Salesforce, on a daily, weekly or monthly schedule | The running user | Shared dashboards that must be current at a set time |
| Subscription | Salesforce, on a schedule you set | The running user's refreshed data, sent to you | Getting a snapshot without opening Salesforce |
Manual refresh
Open the dashboard and select Refresh. Components update, and the timestamp changes. In a dynamic dashboard, the refresh uses the viewer's access, so every viewer must refresh for themselves. Nobody else can refresh a dynamic dashboard on their behalf.
Scheduled refresh
Scheduling refreshes the dashboard automatically so viewers see current numbers when they open it.
- Open the dashboard and select the arrow next to Refresh, then Schedule Refresh (the label can vary by release).
- Choose the frequency (daily, weekly or monthly), the days, and a start time.
- Save the schedule.
Pick a time before people start work, such as early morning. Refreshes run as the running user, so these problems are common:
- The running user is deactivated. The schedule then stops working, so assign a stable, active running user.
- The running user loses access to a source report folder. Components come back empty or show errors.
- Many refreshes run at the same time, so they queue and finish later than you expected.
Dynamic dashboards cannot be refreshed on a schedule, because there is no single running user whose data could be used. If your business needs fixed-time numbers, use a static dashboard with a suitable running user, such as a service-style user with broad access, and use dashboard filters or separate dashboards for the audiences that need different views. Check the data-visibility consequences first: everyone who can open that dashboard sees everything that user can see.
Subscriptions
A subscription sends you a refreshed snapshot of the dashboard by email on a schedule. Open the dashboard, select Subscribe, and set the frequency, days and time. Subscribing also needs access to the dashboard's folder. Editions limit how many dashboards a user can subscribe to, so check your edition's limits before rolling this out widely.
Subscribers see what the running user sees. Subscribing does not widen anyone's access, but it can reveal data to a person who has folder access and normally would not open the dashboard.
Finding scheduling candidates with SOQL
Only dashboards with a specified running user can use scheduled refresh. This query lists them:
SELECT Id, Title, FolderName, RunningUserId
FROM Dashboard
WHERE Type = 'SpecifiedUser'Exercise
A sales director wants the pipeline dashboard to show each regional manager only their own region's opportunities, and wants it refreshed automatically at 6 a.m. Why can't one dashboard do both, and what is a workable alternative?
Show answer
A dashboard that shows each manager their own data must be a dynamic dashboard (run as the logged-in user), and dynamic dashboards cannot use scheduled refresh. Workable alternatives are one static dashboard per region, each with a specified running user and a 6 a.m. schedule, or a single dynamic dashboard that managers refresh manually when they open it.