In Winter ‘20 we introduced the ability to schedule a flow, which allows you to run a certain flow on a daily basis, for example. With Spring ’21, we take it a step further by introducing scheduled paths inside of a flow. With Scheduled Paths you can trigger certain types of events based on date fields on the object that triggered the flow. A great example of a scheduled path would be to create a task AND schedule a notification to be sent out to a user one hour before the task is due. In the past, this would require a lot more heavy lifting.
How do they work?
Before you get started with Scheduled paths, you must keep in mind that they are currently only available on the following types of Record-Triggered flows:
|Trigger||Timing||No Condition||A Condition Exists|
|Every time a record is updated and meets condition requirements||Only when a record is updated to meet the condition requirements|
|A record is created||before save|
|A record is updated||before save|
|A record is created or updated||before save|
|A record is deleted||after save|
You must also note that the functionality only shows up if you use the Freeform layout in Flow. They are not available in the Auto-Layout builder that is currently in beta. When you’ve met the above conditions and then choose the object, the Scheduled Path option automatically appears on the starting step of the flow.
The UI for setting up the scheduled paths is similar to the creation of a Decision step, but instead of specifying the outcomes, you now specify the various points in time to execute that path.
For each path, you must specify the date/time field that is used to calculate the start time and then specify how many hours or days later that path should run.
Scheduling test drives
Using the eCars Sample App we can take a look at how to use Scheduled Paths. Pulsar Motors is a manufacturer of electrical cars. In the past, a customer would just come to the dealership to test drive the cars. Unfortunately, with the current Covid-19 crises, this has all changed and test drives need to be scheduled so that all the required safety measures are taken.
To support this, Pulsar Motors has created the Test Drive custom object to manage test drive scheduling. This object holds information on the contact who wants to make the test drive, with which model, and for when it is scheduled. Given this new way of working, they decided that it would be a great idea to send out some reminders to the customers to reduce the number of no-shows. So using Flow, they decide to:
- Send out a confirmation email when the test drive is created.
- Send out a reminder email a day before the test drive is scheduled.
- Send out a reminder SMS an hour before the test drive is scheduled.
To get started, we can create a Record-Triggered Flow that fires on create and update that runs after the record is saved.
Next, we must specify the object that triggers the flow. Here we choose the Test Drive object and set the condition that the date/time for the test drive must be set.
This is important because we scheduled paths that will only be available in this use case when ‘Only when a record is updated to meet the condition requirements’ is selected. Once this has been saved, the Scheduled Paths option now becomes visible and we can configure them.
Two examples of Scheduled Paths we can use are:
- Setting up an email reminder that triggers one day before the test drive.
- Setting up an SMS reminder one hour before the test drive.
Note that both of these examples are required to point to a Time Source, this defines the field that the schedule looks for – and then defines the number of days or hours before the time source that the path is triggered.
Each path can then be branched out from the start of the flow so that you can run multiple actions from the single flow based on the defined schedule.
Once the Flow is active you may want to have a look at what is currently scheduled. We have created a test drive record with a Pickup Time of 2/19/2021 at 8:30am.
Based on our flow definition we would expect the email reminder to be sent out on 2/18/2021 at 8:30am (one day before) and the SMS reminder at 2/19/2021 at 7:30am (one hour before). We can check that this has been scheduled by navigating to Setup → Environments → Monitoring → Time-Based Workflow.
There we can see the two paths being scheduled for the same record:
Appointments have a habit of changing, so what do we need to do when the time changes on the record? The person doing the test drives decides that 8:30am is very early and the time is changed to 12:30pm. You might be afraid at this point that we now end up with double reminders, but when we look at the Time-Based Workflows we see that those have been replaced with the new values and the old values are gone. So it has automatically adapted to the newly set appointment time.
Scheduled Paths are a fantastic new addition to Flow that open a lot of possibilities without having to write code. Just be aware that there are requirements to make them available for use and follow the documentation properly.
About the author
Jack van Dijk is a Distinguished Architect working for Salesforce in the Netherlands. He has now more than four years experience in Salesforce and over 20 years in the CRM world. Jack can be reached at https://www.linkedin.com/in/jackvandijk/