Sub topic 3
Where Flow is the Right First Choice
This chapter assumes you know the Salesforce data model (objects, fields, records), can find your way around Setup, and have built at least one simple Flow. It also assumes basic programming ideas such as variables, loops, and collections. It covers the kinds of requirements Flow handles well and why Salesforce recommends starting there.
Why start with Flow
Flow is Salesforce's declarative automation tool. You build logic by arranging elements on a canvas and setting their properties, not by writing code. For many requirements this gives you three advantages:
- Speed. An admin can build, change, and activate a flow without a developer, a code review cycle, or a deployment of Apex tests.
- Lower maintenance cost. Other admins can open the canvas and read the logic. The same logic in code needs someone who reads Apex.
- Built-in platform features. Flow handles bulk processing of records, field-level entry conditions, and debugging tools without extra code from you.
This does not mean Flow is always correct. It means Flow is the default to try first. You move to Apex when a requirement clearly does not fit, which the next chapter covers.
Requirements that fit Flow
Flow is a strong fit when the logic is mostly about reading or changing records and routing people through steps. Common cases are:
- Record-triggered updates. When a record is created or changed, set fields on it, or on related records.
- Creating related records. When an Opportunity closes as won, create a follow-up Task or a renewal Opportunity.
- Sending notifications. Send an email alert, post to Chat, or send a custom notification when a condition is met.
- Guided data entry. A screen flow walks a user through several screens and saves the result. Examples are a case intake form or a quote wizard.
- Scheduled work. A scheduled flow runs at a set time, for example to flag every Case that has been open for more than 30 days.
- Approvals and routing. Assign owners, submit records to approval, or branch by region or record type.
The pattern is the same in each case. The data is already in Salesforce, the rules are simple conditions, and the result is a standard action such as an update, create, or notification.
A worked example
Suppose the requirement is: when an Opportunity moves to Closed Won, create a Task for the account owner to schedule an onboarding call due in 7 days.
In Flow, you would build a record-triggered flow:
- Object: Opportunity. Trigger: a record is created or updated.
- Entry condition:
StageNameequalsClosed Won, and set the option to run only when the record is updated to meet the condition. This stops the flow from running again on every later edit. - Action: a Create Records element for a Task, with Subject "Schedule onboarding call",
WhatIdset to the Opportunity Id,OwnerIdset to the Opportunity's account owner, and an activity date of today plus 7.
No code is needed. An admin can change the due date or the subject in a minute.
Choosing the flow type
Pick the flow type by what starts the work.
| Flow type | Starts when | Typical use |
|---|---|---|
| Record-triggered | A record is created, updated, or deleted | Set fields, create related records, send alerts |
| Screen | A user opens it | Guided forms and wizards |
| Scheduled-triggered | A set time arrives | Nightly or weekly batch updates |
| Autolaunched | Another flow, Apex, or an API call starts it | Reusable logic called from elsewhere |
Flow signals to look for
A requirement probably belongs in Flow when most of these are true:
- The logic can be drawn as a few branches and loops.
- It uses standard objects and standard actions.
- The people who will maintain it are admins.
- Data volume per transaction is modest.
- The business expects to change the rules often.
Common errors
- Using a flow for everything. Flow has limits. Heavy calculation, complex data structures, and callouts with custom authentication are signs you need code.
- Building a flow that runs on every update. Without a changed-value condition, a record-triggered flow fires on each save and may update records again, causing loops.
- Putting a query or update inside a loop. Flow can bulkify some of this for you, but a Get Records or Update Records element inside a loop still adds up against governor limits. Collect records into a collection and update them once after the loop.
- Skipping fault paths. An unhandled error rolls back the transaction and shows users a generic message. Add a fault connector that logs or reports the problem.
Exercise
A team wants every new Case with Priority "High" to get a Task for the owner, due tomorrow. An admin will maintain it. Which flow type do you choose, and what do you put in the entry condition?
Show answer
A record-triggered flow on Case, triggered when a record is created. The entry condition is Priority equals High. A Create Records element then makes the Task with a due date of today plus 1.
Exercise
Why should a record-triggered flow use "only when a record is updated to meet the condition requirements" for its entry condition?
Show answer
It makes the flow run only when the record changes from not meeting the condition to meeting it. Without it, the flow runs on every later save of a matching record, which wastes resources and can repeat actions such as creating duplicate Tasks.