-
Notifications
You must be signed in to change notification settings - Fork 0
Make a DashboardTarget_Run_object_updates Flow
I would have liked to include in this package a template flow for updating all the dashboardtargets once per day. But that flow has to be based on the subflows for each object. And you can't include one of those subflows in in the flow unless it's active, which means I would have to ship the subflow(s) active just to ship this scheduled flow.
Instead, let me show you how to build your own flow that can update all the dashboardtargets in your org! Actually, we're going to build two versions, one for use on-demand and one that will be scheduled to run, probably once per day.
We'll build the on-demand version first. This is really a very simple flow:
- Create a new Autolaunched Flow (No Trigger) and name it DashboardTarget_Run_object_updates (or whatever you would prefer.)
- Add a Pause element. This step is not strictly necessary. But putting in this pause element ensures that the actual work of the flow (updating all the DashboardTarget records) is completed asynchronously and, therefore, is less likely to hit limits.
- Set the pause element to Always Pause flow - No Conditions
- Then click on the RESUME EVENT tab and set that to resume at a specific time, with the base time being the start time of the flow interview, and the offset being 0 Hours.
- Last, add the subflow (or subflows) that you have to run the dashboardtarget updates for each object. In the picture above I have just one object worth of subflows (Contact).
- If you think you might need it, you could add additional pause elements before some of those subflows.
- Activate this flow.
Now you have a flow ready that will update all dashboardtargets asynchronously. This is suitable for adding to your dashboardtarget record page or Lightning page as a button, as noted here.
Building a schedule-triggered flow allows you to have your dashboardtargets update regularly so they keep up with any changes that might happen, such as students coming or going from your program. And having already built the on-demand version it's really easy to make the scheduled version.
- Open your on-demand flow from above and choose Save As.
- Click Show Advanced and then change the Type to Schedule-Triggered Flow.
- Give your flow a new name and description, such as DashboardTarget_Scheduled_Run object updates
- Set the start date and time.
- Save your flow and activate it.
That's it. Your flow should run on your schedule and update all your targets. (I like to create a new auto-update target and leave its Target field blank, then the next day I can check to be sure the scheduled flow ran.)
If you found this tool useful I would love it if you showed your support through a donation to Enchantment Theatre Company, which inspires children to dream, explore, think, and connect through imaginative storytelling onstage and in the classroom. I am the chairman of the board of ETC.