Skip to main content

Add a Scheduled Task to Your Flow

Learning Objectives

After completing this unit, you’ll be able to:

  • Identify how to trigger a flow on a schedule.
  • Create a scheduled path to run a record-triggered flow at a specified time.

Automation on a Schedule

By default, a record-triggered flow runs when a record changes in a specified way. But you can delay that automation by using a scheduled path. Actions on a scheduled path are triggered when the specified record change occurs, but run after a period of time. This can be minutes, hours, days, or even months after the record change. They can also be scheduled for a period of time before or after a field on the triggering record. For example:

  • 6 hours after a case is created
  • 2 days after the renewal date for an account
  • 1 month before the warranty expiration date

Business Requirement

Let’s expand our opportunity flow to include a new business requirement: Remind the opportunity owner to follow up with the account owner 5 days after the opportunity closes. 

Note the timing “5 days after”. To create that 5-day delay in the flow, we add a scheduled path. In the scheduled path we create a task for the account’s owner.

Before You Start

You should define your org's Default Workflow User before you start creating scheduled paths. This setting tells Salesforce which user runs the flow's scheduled path. This setting might already be set in your production org, but it’s a good idea to confirm it. Make sure that this setting is correct in the Trailhead Playground you’re using for this badge before you create a scheduled path.

Set the Default Workflow User on the Process Automation Settings page in Setup.

The Process Automation Settings page. Default Workflow User is Flo Smith.

Configure Scheduled Paths

  1. Under Flow Definitions, select the Triggered Flows list view.
  2. In the Flow Label column, click Closed Won Opportunities. The flow opens. ""Because we chose Actions and Related Records when we created the original flow, we can add our scheduled path directly in this flow. You can use scheduled paths only when the flow uses the Actions and Related Records option.
  3. Click Add Scheduled Paths (Optional).The Scheduled Paths panel. Fields include Path Label, API Name, Time Source, Offset Number, and Offset Options.
  4. For Path Label, enter 5 Days After Close. The API Name field is automatically updated to X5_Days_After_Close.
  5. For Time Source, select Opportunity: Close Date.
  6. For Offset Number, enter 5.
  7. For Offset Options, select Days After.

Add a Task

Now let’s add the task to remind the opportunity owner to follow up with the account owner five days after the opportunity closes.

  1. In the 5 Days After Close path, hover over Add Element  and click Add Element.
  2. Scroll to the Data section and click Create Records. The New Create Records window opens.The New Create Records panel. Fields include Label, API Name, Description, How Many Records to Create, and How to Set the Record Fields.
  3. For Label, enter Personalized Welcome Task. The API Name is automatically updated to Personalized_Welcome_Task.
  4. For Description, enter Creates a task for the Account owner to reach out and welcome a new customer.
  5. For How Many Records to Create, keep One selected.
  6. For How to Set the Record Fields, select Use separate resources, and literal values.
  7. For Object, select Task.

Set Conditions

  1. Under Set Field Values for the Task, set the task subject:
    1. Field: Subject
    2. Value: Personalized Welcome
  2. Click Add Field.
  3. Describe the task:
    1. Field: Description
    2. Value: Reach out with phone call to welcome new customer
  4. Click Add Field.
  5. Associate the new task with the opportunity that triggered the flow:
    1. Field: WhatId
      The WhatId field can refer to the ID of any related non-human object. It represents something other than a person, such as an account, opportunity, campaign, case, or custom object. To refer to a person object, such as contact, use WhoId.
    2. Value: $Record > Id
      Remember, data from the record that triggered the flow is stored in the $Record variable. To reference the record itself, drill down from $Record to the Id field.
  6. Click Add Field.
  7. Set the owner of the new task to match the owner of the opportunity that triggered the flow:
    1. Field: OwnerID
    2. Value: $Record > OwnerId
  8. Click Add Field.
  9. Set the task due date:
    1. Field: Activity Date
    2. Value: enter today’s date (You usually use a formula resource to dynamically set the activity date to a date in the future, but for simplicity in this module, we use today’s date.)
  10. Click Save As | A New Version | Save.

Adding the scheduled task is complete! Now let’s test to make sure that it's working properly.

Debug the flow

  1. Click Debug. The Debug flow window opens.Debug flow screen. Fields include Select Path, Debug Options, and Run the Flow As if the Record is Created or Updated.
  2. For Path for Debug Run, select 5 Days After Close.
  3. For Debug Options, click Skip start condition requirements.
  4. For Run the Flow As If the Record Is, keep Created selected.
  5. For Opportunity, select the same organization you used in unit 1 to run the flow against. (This example uses Grand Hotels Emergency Generators.)
  6. Click Run.
    The flow is debugged. If it ran successfully, the line connecting elements is orange.
  7. Click Back ( Back ) to exit Flow Builder.

Success! Using both an immediate path and a scheduled path, you’ve created a flow that automatically manages your high-value opportunities.the completed flow with 2 branches, run immediately and 5 days after.

Tell Me More

You can expand this flow to include more criteria and actions. If an opportunity doesn’t meet the conditions (greater than 25000 and Closed Won), do something different. For example, check whether a high-value opportunity is Closed Lost. If it is, automate different actions. But don’t stop there. What record-triggered flows can you build on other objects?

Resources

Keep learning for
free!
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities