How to start a flow on schedule in Salesforce



Scheduled Flows were released in Winter ‘20. Scheduled Flows are flows that are scheduled to run on a specific date and time either once or daily or weekly. To have the scheduled flow run for a batch of records, specify the object and the filter conditions that each record must meet. Let’s get started that How to Schedule an autolaunched flow?

To schedule a flow,

Step 1: Go to Flows in Setup.

Step 2: Click New.

Step 3: Select Autolaunched Flow.

Step 4 : Double click the Start component to schedule it.

Step 5 : Now Click on the option Scheduled jobs – flow runs for a batch of records

Step 6: For scheduling the flow, Click on Flow Trigger and select Schedule from the drop-down menu.

Step 7: For setting up a Schedule, Select the Start Date and Start Time.

Step 8: Now click on Frequency and select the required frequency like once, daily or weekly from drop-down menu.

Step 9: When your flow starts, a flow interview runs for each record that matches your filter—no looping required.

Step 10: The matching record is stored in the $Recordglobal variable, so you can reference the variable or its fields throughout your flow.

Step 11: Salesforce has given a wonderful option where we can run the flow for a set of records by using filter conditions.

The procedure for running a flow for a set of records.

Step 12: Firstly, Click on the object and select the Account object for example.

Step 13: Now click on the condition requirements and select the required conditions like when Conditions are met (AND) and Get All Account Records (No Conditions) from drop-down menu.

Step 14: Now select the field you want to use for filtering the records. For example, field criteria is Type Equals Household.

Step 15: Moreover, the Values from each record are stored in the $Record global variable.

Step 16: On the Flow Builder canvas, a flow shows its scheduled start time.

 

Step 17: To monitor flows that are scheduled to start, from Setup, enter Scheduled in the Quick Find box, then select Scheduled Jobs.

Note: To check whether a scheduled flow exceeds the org limit, check the debug logs to see the number of records that the flow runs on. The number of records equals the number of scheduled flow executions, because a flow runs for each record. Track the number of records with the new FLOW_START_SCHEDULED_RECORDS debug log line. If the flow exceeds the org limit, Salesforce sends an error email to either the admin who last modified the associated flow or the Apex exception email recipients.