Sub topic 6
Screen Flows for Guided User Interaction
This chapter assumes you know what a flow is, how Flow Builder is laid out, and the difference between a flow and a record-triggered flow. It also assumes you have seen basic Flow elements such as Get Records, Assignment, and Decision. You will learn when a screen flow is the right tool, how it works internally, and which mistakes cause the most trouble.
What a screen flow is
A screen flow is a flow that a person starts and interacts with. It shows one or more screens, collects input, runs logic between screens, and ends by saving data or showing a result. Unlike a record-triggered flow, nothing fires it automatically. A user, a button, a page component, or a link must launch it.
Use a screen flow when the process needs a human in the loop. Typical cases:
- Guided data entry, such as a multi-step intake form for a case.
- Wizards that branch based on answers, such as a quote request that asks different questions for different products.
- Actions that need confirmation before data changes, such as closing a case with a required resolution code.
- Creating several related records in one step, such as an account, a contact, and an opportunity.
If no one needs to see or answer anything, a screen flow is the wrong tool. A record-triggered or scheduled flow fits better.
How a screen flow runs
A screen flow alternates between two kinds of work. Screens wait for the user. Everything between screens (Decisions, Assignments, Get Records, Create/Update/Delete Records, Actions) runs on the server as one batch of work until the next screen or the end.
Two consequences follow from this model.
- Each stretch of server-side work between screens runs in its own transaction, and it counts against governor limits (the per-transaction caps on queries, DML statements, and CPU time). A DML statement is an operation that creates, changes, or deletes records.
- Data is not saved until a Create, Update, or Delete element runs. If the user closes the browser on screen 2, any records that earlier elements already saved stay saved, and nothing later happens.
Ways to launch a screen flow
| Launch point | Typical use | Notes |
|---|---|---|
| Quick action on a record page | Guided task on one record | Receives the record through a `recordId` variable |
| Lightning page component | A flow embedded in a Home, App, or Record page | Can be configured with input values |
| Utility bar | Always-available tool for agents | Good for lookups and quick forms |
| Custom button or link | Launch from a list view or related list | Use a URL with the flow's API name |
| Experience Cloud site | Customer or partner self-service | Requires the right access for guest or site users |
| Another flow (subflow) | Reusable steps | Called from a parent flow |
To receive the current record, create a variable named recordId, type Text, and mark it as available for input. Lightning record pages fill it in with the record's ID. A common pattern is to start the flow with Get Records using that ID. The Get Records element retrieves the full record so you can show fields on a screen.
Building the screens
Screen components fall into three groups.
- Input components: Text, Number, Date, Picklist, Checkbox, Lookup, and File Upload.
- Display components: Display Text, Display Image, and Data Table.
- Custom components: Lightning Web Components (LWCs) built by developers, which you can add when the standard set is not enough.
Useful features to know:
- Validation on components. Each input can have a formula that must be true before the user moves on, plus an error message. This avoids saving bad data.
- Conditional visibility. A component can show only if another field has a given value. This keeps screens short.
- Navigation controls. Allow or hide Previous, Next, Pause, and Finish buttons. Hide Previous when going back would repeat a data change.
- Reactive screens. Components on the same screen can respond to each other's values without moving to a new screen. Use this in place of an extra screen when you can.
A worked example: closing a case
Suppose support managers want agents to close a case only after picking a resolution and optionally creating a follow-up task. A validation rule can require the resolution on closure, but it cannot offer the follow-up step or explain what to choose. A screen flow can.
- Launch from a quick action on Case, with
recordIdas an input variable. - Get Records: find the Case by
recordIdand store it in a record variable calledvarCase. - Screen: a Picklist for resolution, a Checkbox "Create follow-up task", and a Text Area for notes. The resolution is required.
- Decision: if the checkbox is true, go to the Task path. Otherwise skip it.
- Create Records: a Task related to the case.
- Update Records: set
varCase.Statusto Closed andvarCase.Resolution__cto the chosen value. - Screen: confirmation message.
Notice the order. The flow changes the case only after all input has been collected. Placing the Update before the Task would still work, but if the Task creation failed, you would have a closed case with no follow-up. The final data changes should go last whenever you can arrange it.
Errors and fault handling
Any element that touches data can fail. A validation rule on the object may reject the update, a required field may be empty, or a limit may be hit. If you do nothing, the user sees a generic flow error and the flow stops.
Add a fault path to Create, Update, Delete, Get, and Action elements. A fault path is a connector that runs when the element fails. Route it to a screen that shows {!$Flow.FaultMessage}, which holds the error text. That gives the user something to act on and lets an admin see the cause.
Common mistakes
- DML or queries inside a loop. A Loop element that contains a Create, Update, or Get Records element runs it once per item. For a long list this hits limits. Build a collection in the loop with Assignment, then run one Update outside the loop.
- Assuming the user finishes. Users close tabs. Do not rely on a final screen to do essential work.
- Running in the wrong context. A screen flow can run in user context or system context, depending on the launch method and the setting. In user context, the user's permissions apply. In system context, the flow can read and change data the user could not. Check this setting for flows exposed to external users.
- Too many screens. Long wizards cause drop-off. Combine questions with reactive screens and conditional visibility.
- Forgetting the Pause feature. If a flow takes a long time to fill in, enable Pause so users can resume later. Paused flows can be resumed from the Paused and Waiting Interviews list.
- Using a screen flow where a validation rule or formula would do. If a rule on the object solves the problem, that rule also protects data entered through imports and APIs. A screen flow protects only the path through the flow.
Screen flows against other tools
| Need | Screen flow | Alternative |
|---|---|---|
| Guided input from a user | Best fit | Page layout with dynamic forms, if fields only need to show or hide |
| React to a record change with no user | Wrong tool | Record-triggered flow |
| Run nightly on many records | Wrong tool | Scheduled flow |
| Formal sign-off | Not designed for it | Approval process |
| Complex UI beyond standard components | Possible with custom LWCs | Lightning Web Component with Apex |
Screen flows also have a place in the decision list from the first chapter: step 3 says to use a screen flow when a user needs guided steps. If the same requirement also needs enforcement, combine tools. For example, use a validation rule for the invariant and a screen flow for the guided path.
Testing and debugging
Use the Debug button in Flow Builder to run a screen flow with sample input values. You can set the input variables, choose to run with a particular user's permissions, and see each element's result. Test three paths for any flow: the normal path, a path where a fault occurs, and a run by a user with the least permissions you expect.
Exercise
A manager wants agents to see a short wizard when they click "Escalate" on a case. The wizard asks for a reason, shows a different follow-up question for each reason, and then updates the case and creates a task. Which flow type fits, and name two settings or design choices that keep it from failing in production?
Show answer
A screen flow launched from a quick action on Case. Use a recordId input variable and conditional visibility or reactive screens for the reason-specific question. To keep it reliable, add fault paths on the Create and Update elements that lead to an error screen, and run the data changes after all input is collected. Also check the run context so the agents' permissions allow the update, and keep any Create or Update outside of loops.