Sub topic 2
Debugging a flow in Flow Builder
This chapter assumes you can build a basic flow: add elements, create variables, and use Get Records, Decision, and Update Records elements. You need a sandbox or Developer Edition org. Run debug sessions there first, because a debug run can write real data unless you protect it (the next chapter covers this).
What the debugger does
The Flow Builder debugger runs your flow from inside the canvas. It then shows what happened. You don't need to activate the flow, deploy it, or trigger it from a record page.
A run produces three kinds of output:
- The path. The elements the interview visited are highlighted on the canvas. Elements it skipped stay unhighlighted.
- Element details. Each visited element lists its inputs, its outcome, and any error.
- Variable values. You can see what each variable held at the point where the flow used it or changed it.
An interview is one run of a flow. Every time a flow starts, whether from a user, a record change, or a schedule, it creates an interview. The debugger creates one interview, and you control how it starts.
The debugger answers the question "what did this flow do with this input?" It doesn't tell you what happened to a real user last Tuesday. For that you need debug logs and error emails, which later chapters cover.
Starting a debug run
- Open the flow in Flow Builder.
- Save it. Debugging a flow with unsaved edits can be confusing, because you can't tell which version produced the result.
- Click Debug in the toolbar.
- Set the options for your flow type.
- Click Run.
What you see in the options depends on how the flow starts.
| Flow type | What the debugger asks for |
|---|---|
| Screen flow | Values for input variables, then the actual screens, which you fill in |
| Autolaunched flow | Values for input variables. No screens appear |
| Record-triggered flow | A record to act as the trigger. For update triggers, an existing record |
| Schedule-triggered flow | Nothing special. The flow runs against the records its filter finds |
Treat the test record as your test case. For a record-triggered flow that fires when an opportunity reaches Closed Won, you need a record whose values satisfy the entry conditions.
A record-triggered debug run is a simulation. For an update trigger, the debugger gets the selected record and applies the change you describe. It then runs the flow as if that update had just happened. This is why $Record and $Record__Prior are both available in your flow during a debug run.
The next chapter covers the specific options: input values, rollback, and running as another user. This chapter focuses on reading the results.
Reading the debug results
After a run, the Debug Details panel opens beside the canvas. It lists steps in the order they executed. Each entry has an element name, and you can expand it.
Here is the typical shape of a successful run, written as plain text:
Flow Interview Details
Interview label: Close_Won_Follow_Up 11/30/2026 1:08 PM
Status: Finished
START Close_Won_Follow_Up
Triggering record: Opportunity 006xx0000012ABC
Entry conditions met: StageName equals Closed Won
DECISION Is_Large_Deal
Outcome executed: Large_Deal
Amount (1500000) greater than 1000000: true
CREATE RECORDS Create_Follow_Up_Task
Result: Successfully created record
Record Id: 00Txx0000045DEFReal output varies in layout, but it always has the same three parts: how the interview started, what each element decided or did, and how it ended.
What to check at each element
Start element. Confirm that the entry conditions evaluated the way you expect. If the flow didn't run at all, the problem is usually here. Either the test record didn't meet the conditions, or the trigger type (create, update, or both) doesn't match your scenario.
Decision elements. The panel names the outcome executed and shows how each condition compared. If a flow takes the Default Outcome when you expected a custom one, expand the Decision and read the compared values. Common causes:
- A text comparison where case or trailing spaces differ.
- A null value, such as a field that was never populated.
- A comparison on the wrong variable, for example
$Recordwhere you meant$Record__Prior.
Get Records. The result tells you whether records were found. A Get Records that finds nothing is not an error. The flow simply continues with an empty variable. A later element then fails or misbehaves because it expected a value. When you see a failure on a later element, look back at the Get Records upstream.
Assignment. The panel shows the variable and the new value. This is the quickest place to catch operator mistakes. Using Add on a text variable concatenates it, and using Equals replaces the old value.
Loop. Each iteration appears as its own set of entries. Check the number of iterations against the number of records you expected. A loop that runs once instead of five times usually means the collection was filled wrongly upstream.
Create, Update, and Delete Records. The panel shows the field values the element tried to write. If a write fails, the error message appears here and names the element.
Reading an error
When an element fails, the debugger stops at that element and displays the error. The error text usually comes from the Salesforce platform and is the same text a user would see. Typical examples:
REQUIRED_FIELD_MISSING: a field the object requires wasn't set. Check the Assignment or the field mappings.FIELD_CUSTOM_VALIDATION_EXCEPTION: a validation rule rejected the write. The flow isn't broken. Its data fails the rule.INSUFFICIENT_ACCESS_OR_READONLY: the running user can't edit this record or field.UNABLE_TO_LOCK_ROW: another transaction holds a lock on the record.Too many SOQL queries: 101: a governor limit was exceeded. The transactions chapter explains this.
The error shows what failed, but the real cause is often upstream. A REQUIRED_FIELD_MISSING at an Update Records element often means an earlier Get Records returned nothing and left the variable null.
A debugging loop that works
Random clicking in the debugger wastes time. A repeatable loop is more reliable.
The key step is "find the first element that is wrong." Later elements often fail because of an earlier one. Walk the Debug Details from the top and stop at the first value that doesn't match your expectation.
Test more than one path
A flow that passes one debug run has been tested on one path. For every Decision, run at least one input per outcome, including the Default Outcome. Also test the boundaries. If a rule says "greater than 1,000,000," try 1,000,000, 1,000,001, and a null amount.
Keep a short list of test inputs next to the flow. A note in the flow's description or a shared document is enough. This list becomes your Flow Builder tests in a later chapter.
Debugging screen flows
Screen flows show the debugger and the screens together. You fill in the screens as a user would, and the Debug Details panel updates behind them.
Points specific to screen flows:
- Component visibility rules and validations run as they would for a user. If a field never appears, check its visibility condition in the Debug Details.
- Entering values in a screen overwrites the screen component's output variables. Look at the values in the panel after you click Next.
- The Previous button is still available if you enabled it, so you can go back and try different inputs without restarting.
Debugging with fault paths
A flow with no fault path stops at its first error. The debugger then shows the failure and ends the interview. If you add a fault path, the flow follows that path and continues.
This changes what you see in debug mode. A flow that "works" in the debugger can be hiding errors, because the fault path catches the failure and finishes normally. When debugging, check the Debug Details for fault-path entries even when the final status is Finished.
You can use the global variable $Flow.FaultMessage to report what went wrong. This text works in the body of an email alert or a Create Records element that writes a log record:
An error occurred in the flow: {!$Flow.FaultMessage}
Flow: {!$Flow.CurrentDateTime}
Record Id: {!$Record.Id}$Record.Id applies only in record-triggered flows. In a screen or autolaunched flow, pass the record ID through your own variable. The fault-paths chapter covers building these paths in full.
Limits of the debugger
The debugger is a good first check, but it doesn't reproduce everything.
- It runs one interview. It can't show you what happens when 200 records arrive in one transaction. Bulk behavior needs the bulk tests covered later.
- It depends on the running user. By default you run the flow as yourself, with your permissions. A flow that works for an admin can fail for a standard user.
- It may not reproduce side effects exactly. Some actions, such as sending email or making an outbound callout, happen for real or are skipped, depending on the action.
- It doesn't replace logs. For a failure that happened to someone else in production, you need the debug log or the error email.
Common mistakes
- Debugging an old version. The debugger runs the version open in the builder. Check you're not looking at an older version.
- Using a record that doesn't meet entry conditions. The flow starts, finds nothing to do, and appears to "do nothing." Read the Start entry first.
- Treating "Finished" as "correct." A flow can finish and still do the wrong thing. Compare the values in Debug Details with what you expected.
- Testing only the happy path. Most real failures come from nulls, empty collections, and permission differences.
- Fixing the symptom. Changing the failing element's mapping often leaves the actual upstream cause in place.
Summary
The Flow Builder debugger runs one interview from the canvas and records the path, each element's inputs and outcomes, and variable values. Pick a test input, run it, and find the first element whose result doesn't match your expectation. Test each Decision outcome and each boundary. Remember that fault paths can hide errors and that the debugger covers one record at a time.
Exercise
A record-triggered flow creates a follow-up task when an opportunity is set to Closed Won. In the debugger the interview shows "Finished," but no task was created. List the first two things you check in the Debug Details, and say why "Finished" isn't enough to conclude the flow works.
Show answer
First, check the Start element to confirm the test record met the entry conditions (for example, that the stage changed to Closed Won, so the flow actually ran its logic). Second, check any Decision element for the outcome executed, since a Default Outcome path may skip the Create Records element. You also look for a fault-path entry, because a fault path can catch an error and let the interview finish normally. "Finished" only means the interview ended without an unhandled error. It doesn't mean the intended path ran or that the data was written.