Sub topic 6
Screen flows for guided user interaction
This chapter assumes you know the Salesforce data model, can navigate Setup, and have seen Flow Builder at the level of the previous chapter on flow types.
What a screen flow is
A screen flow is a flow that a person runs and interacts with. It shows one or more screens, collects input, and then creates, updates or reads records based on the answers. Unlike a record-triggered flow, nothing starts it automatically. A user, a button, a page component or a link has to launch it.
Use a screen flow when the process needs a human to make choices or enter data in a set order. Typical cases are a guided lead intake, a case escalation wizard, or a "log a return" form that touches several objects.
The working model
A screen flow is built from three kinds of elements:
- Screens display components such as text inputs, picklists, lookups and data tables. Each component stores its value in a variable you can use later.
- Logic elements, such as Decision and Assignment, branch on those values.
- Data elements, such as Get Records, Create Records and Update Records, read and write Salesforce data.
The flow runs in the context of the user who launched it. By default, a screen flow respects that user's permissions. The flow's run mode setting can change this, so check it before you build anything that edits records the user normally cannot see.
Where users launch them
You can start a screen flow from a Lightning page, an action or button on a record, a utility bar item, a Experience Cloud site, or a direct URL. Pass the current record's Id into the flow through a variable marked "Available for input". This lets the flow work on the record the user is viewing.
Choosing a screen flow
| Requirement | Better fit |
|---|---|
| User must answer questions in steps | Screen flow |
| Field changes whenever a record is saved | Record-triggered flow |
| Work runs nightly on many records | Scheduled flow |
| Manager must approve a change | Approval process |
Common errors
- Doing DML inside loops. Placing Create or Update Records inside a Loop element hits governor limits. Collect records in a collection variable, then run one data element after the loop.
- Losing data on Back. If a screen does not store its values in variables, users who press Previous can lose input. Check that every component maps to a variable.
- No fault path. A failed Create Records element shows a generic error. Add a fault connector that routes to a screen with a clear message.
- Using a screen flow for something that should be automatic. If users could skip or forget the step, the rule belongs in a record-triggered flow or a validation rule.
Exercise
A support team wants agents to answer five questions, then create a Case and a related Task in one step. A nightly job is not wanted. Which flow type fits, and why should the Create Records elements not sit inside a loop?
Show answer
A screen flow fits because agents give input in guided steps and launch it themselves. Create Records elements should not sit in a loop because each pass would run its own DML statement and could exceed the per-transaction DML limit. Build the records in a collection and save them with one element.