In Spring’21 release, Salesforce Launched a new feature called Scheduled Path in the Flow Builder. If we want to run a part of flow or the entire flow at schedule time, we can add a Scheduled Path to record-triggered flow. The scheduled time can be based on when the record is created or updated or based on a field value in the record. Scheduled path runs in System mode.
Steps to Implement the Scheduled Path:
When an Opportunity is created / updated
Immediate Action: Type field is updated as New Customer.
Scheduled Action: 5 Days before Opportunity Close Date, create a task for Opportunity Owner.
Create a Record-Triggered Flow and choose Freeform/Auto-Layout in the next screen.
Configure the Trigger Screen:
- Trigger the Flow When: Select “A record is created or updated”.
- Run the Flow: Select “After the record is saved”.
[Note: Scheduled Path is only available after the record is saved.]
Configure the object as “Opportunity” with the criteria to make sure flow is running only when the opportunity is Open. Select “Only when a record is updated to meet the condition requirements” under the “When to run the Flow for updated records” option. This one is important; otherwise, you will not find the option to configure the scheduled path.
Configure the scheduled path. We can see the option in the Start element.
Configure the immediate action. First, create the Assignment to update the Type field as New Customer and then Update the Opportunity record. We can connect them with Start element as Immediate Action.
Configure the scheduled action. Build the flow paths that we want to execute at the scheduled times. When we connect with Start element to another element, choose from the scheduled paths.
When a new or updated record triggers our flow to run, the scheduled paths are placed in a queue until their scheduled times to run. We can monitor these and other pending automations on the Time-Based Workflow page in Setup.
Scheduled paths are available in these debug log events.
- FLOW_SCHEDULED_PATH_QUEUED — An event is logged when a scheduled path is added to the queue after a record is created or updated.
- FLOW_VALUE_ASSIGNMENT — An event is logged when a scheduled path runs.