Blog › How-to guide
How-to guide

How to build a record-triggered flow in Salesforce

Record-triggered flows run automatically when a record is created, updated or deleted. In this guide we build a common example: when an opportunity is marked Closed Won, Salesforce creates a kick-off task for the owner.

By Kliper Solutions · 8 min read · Updated October 2026
Time30–45 minutes
DifficultyIntermediate
EditionsMost editions with Flow
You needManage Flow permission + a sandbox

When to use a record-triggered flow

Use one whenever something should happen automatically after a record changes: updating fields, creating related records, sending emails or notifications. Flow has replaced Workflow Rules and Process Builder, which Salesforce has retired for new automation.

Step 1: Create the flow

  1. Go to Setup → Quick Find → Flows.
  2. Click New Flow, choose Record-Triggered Flow and click Create.

Step 2: Configure the trigger

  1. Object: Opportunity.
  2. Trigger the flow when: A record is created or updated.
  3. Entry conditions: StageName Equals Closed Won.
  4. When to run: Only when a record is updated to meet the condition requirements, so it fires once, not on every later edit.
  5. Optimize the flow for: Actions and Related Records, because we are creating a new record.

Step 3: Add the Create Records element

  1. Click the + below the Start element and choose Create Records.
  2. Label it Create kick-off task.
  3. Choose Use separate resources, and literal values and object Task.
  4. Set the fields:
    FieldValue
    SubjectKick-off call with customer
    WhatId (Related To){!$Record.Id}
    OwnerId (Assigned To){!$Record.OwnerId}
    ActivityDate (Due Date)A formula resource: TODAY() + 2
    PriorityHigh
Tip: Create the due-date formula first: in the Toolbox, click New Resource → Formula, name it DueInTwoDays, data type Date, formula TODAY() + 2.

Step 4: Debug and activate

  1. Click Save and give the flow a name such as Opportunity – Closed Won Kick-off Task.
  2. Click Debug, pick a test opportunity and simulate the update to Closed Won. Check the debug log for errors.
  3. Click Activate.
  4. Test for real in a sandbox: mark an opportunity Closed Won and confirm the task appears under Activities.

Best practices

  • One object, few flows: keep automation for each object organized so it is easy to maintain.
  • Use entry conditions instead of decisions where possible, so the flow only runs when needed.
  • Build in a sandbox, then deploy with a change set or your deployment tool.
  • Add fault paths to elements that can fail, and notify an admin.
  • Document each flow’s purpose in its description.

Free template

Flow documentation template
Document each flow’s trigger, purpose, owner and fault handling.
Download CSV

Troubleshooting

If this happensDo this
The flow never runsCheck it is Activated, the entry conditions match and “When to run” is set correctly.
Duplicate tasks are createdUse “Only when a record is updated to meet the condition requirements” so it fires once.
A validation rule error appearsThe record created by the flow breaks a validation rule; populate the required fields or adjust the rule.
Admins receive flow error emailsOpen the error email, find the failing element, and add a fault path with a clear notification.

FAQ

Before-save or after-save: which should I use?

Use “Fast Field Updates” (before-save) to update fields on the same record; use “Actions and Related Records” (after-save) to create or update other records.

Can a flow run later, not immediately?

Yes. Add a Scheduled Path to run actions, for example, 3 days after a record changes.

How do I move a flow to production?

Build and test in a sandbox, then deploy with a change set or your deployment tool and activate it.

What about old Process Builders and Workflow Rules?

Use Salesforce’s Migrate to Flow tool to convert them, then test the new flows carefully.

Want us to set this up for you?
Start with a free proof of concept. Daily stand-ups, and you pay only after delivery.
Get your free POC