Skip to content
← Writing

Screen Flow in Salesforce: Build Your First, Step by Step

Build your first Salesforce screen flow step by step: a worked example with input validation and fault handling, plus common mistakes and an FAQ.

·9 min read·Salesforce AI

Key takeaways

  • A screen flow is a guided, click-built form in Salesforce that needs a person to interact with it, and it's the first flow most admins should learn.
  • Build the screens, the Create Records element, input validation and a fault path in the first version, not as a later fix.
  • Flow validation formulas must return true for valid input, which is the opposite of how validation rules behave.
  • Without a fault path, a failed save shows the user a generic "unhandled fault" error and teaches them nothing.

Most first flows are declared finished the moment the happy path saves a record. That's a demo, not a build.

A screen flow is the tool admins reach for when users need a guided form inside Salesforce. This guide builds one from scratch, and my argument is simple: a screen flow isn't done until bad input and a failed save both give the user a clear message. Validation and fault handling go in version one. They take about ten extra minutes now and save you a support ticket every week later.

What is a screen flow in Salesforce?

A screen flow is a flow with screens that a user clicks through, so it only runs when a person starts it and interacts with it.

Salesforce's own Trailhead project describes it plainly: a screen flow requires user interaction, such as clicking a button or entering information into a form, and it can guide users through a process. If you want something to happen automatically when a record is created, that's a record-triggered flow instead.

You build them in Flow Builder, Salesforce's point-and-click canvas. If the building blocks are new to you, Trailhead's Meet Flow Builder unit covers the elements and their categories. Trailhead's Build a Screen Flow & Add Questions unit is the official hands-on walkthrough of the basics.

Use one when a human has to supply information or make a choice: logging a call outcome, guided case intake, a renewal-risk form, an onboarding checklist.

Plan the flow on paper first

Write down the inputs, the one record you'll create, and what happens when it fails, before you open Flow Builder.

Our worked example is a "Log renewal risk" button on the Account page. A rep describes the risk, picks a priority, adds notes and sets a follow-up date. The flow creates a Task on that Account.

Three questions to answer first:

  • Inputs: summary (text), priority (picklist), notes (long text), follow-up date (date).
  • Rules: summary at least 10 characters; follow-up date between today and 30 days out; notes of at least 20 characters when priority is High.
  • Failure: if the Task can't be saved (a validation rule, a required field you missed, a permission gap), the user sees a message and a way forward.

Do this in a sandbox or Developer Edition org. If you're unsure which to use, my guide to Salesforce sandbox types explains the options.

How to build your first screen flow, step by step

Create the flow, add one input variable for the record ID, build one screen, then create the Task.

  1. Create the flow. In Setup, search for Flows, click New Flow, choose Screen Flow, and click Create. Save it as Log renewal risk (API name Log_Renewal_Risk).
  2. Add the record ID variable. Open the Toolbox, click New Resource, choose Variable. Name it recordId, data type Text, and tick Available for Input. When you launch the flow from a record page, Salesforce passes the current record's ID into a variable with exactly this name.
  3. Add a choice set. New Resource, Picklist Choice Set. Object: Task. Field: Priority. Name it Priority_Choices. This keeps your values in sync with the real field.
  4. Add the screen. Click the + on the canvas, choose Screen, and label it Capture risk details. Drag in four components:
    • Text: label Risk summary, API name Risk_Summary, Required.
    • Picklist: label Priority, API name Priority, choice Priority_Choices, Required.
    • Long Text Area: label Notes, API name Risk_Notes.
    • Date: label Follow-up date, API name Follow_Up_Date, Required.
  5. Add a formula resource for the subject. New Resource, Formula, data type Text, name TaskSubject, formula: "Renewal risk: " & {!Risk_Summary}.
  6. Add Create Records. Choose Create Records, label it Create Task. Select One record, "Use separate resources, and literal values", object Task. Set these fields:
    • Subject = {!TaskSubject}
    • ActivityDate = {!Follow_Up_Date}
    • Priority = {!Priority}
    • Description = {!Risk_Notes}
    • WhatId = {!recordId}
    • OwnerId = {!$User.Id}
    • Status = Not Started
  7. Add a success screen. A Display Text component saying "Done. The follow-up task has been created." Connect it after Create Task.

Read it before you point this pattern at Opportunity or Case, which have more required fields than Task.

If you want a clickable link to the new record on the success screen, Trailhead's Collect Contact Info from Your User project walks through that pattern.

Add screen flow validation that stops bad data

Use each input component's Validate Input setting with a formula that returns true when the value is acceptable.

On any screen input component, tick Validate Input, enter a formula and write the error message the user will see. Here's the part that trips up admins who know validation rules: a flow's validation formula must evaluate to true when the input is valid. A validation rule fires when the formula is true. A flow validation fires when it's false.

Apply these to the example:

ComponentFormula (true = valid)Error message
Risk summaryLEN({!Risk_Summary}) >= 10Describe the risk in at least 10 characters.
Follow-up dateAND({!Follow_Up_Date} >= TODAY(), {!Follow_Up_Date} <= TODAY() + 30)Pick a date between today and 30 days from now.
NotesIF({!Priority} = "High", LEN({!Risk_Notes}) >= 20, true)High-priority risks need at least 20 characters of notes.

The third row is the one worth copying. It makes a field conditionally required without a second screen. The error appears on the field itself and the user can't move on until it's fixed.

My take: Put validation in the flow even if the object already has validation rules. The object rule fires after the user has clicked Next and the DML has failed, and the message is often written for an admin. The flow rule fires on the screen, in the user's words. Keep both, and treat the flow rule as the user experience.

Add a fault path so a failed save doesn't dead-end

A fault path routes the flow to your own error screen when Create Records fails, instead of leaving the user with an unhandled fault.

Without one, the user sees a generic message that an unhandled fault has occurred in the flow. Nobody can tell what to fix.

Here's the setup:

  1. On the Create Task element, add a fault path. Elements that can fail, including the Create, Update, Delete and Get Records elements, offer one.
  2. Connect the fault path to a new screen named Something went wrong.
  3. In its Display Text, write: "We couldn't save this task. Please send this message to your admin:" followed by the {!$Flow.FaultMessage} global variable.
  4. On this screen and the success screen, hide the Previous button. Going back after a failed or successful save invites duplicate records, and the flow doesn't undo a save when someone navigates back.

For a team flow, add an Action element before the error screen that emails the admin the fault message and the user's name. Then you hear about failures before users complain.

My take: This is judgement, not a statistic: in my experience flows fail in production at the fault path, not on the happy path. The happy path gets tested because the builder tests it. Nobody tests the day a new validation rule lands on Task and every save starts failing. Build the error screen first, then everything else.

Put the flow in front of users

Save, debug in a sandbox, activate, then expose the flow through a quick action or a Lightning record page.

  • Debug. Click Debug in Flow Builder, enter a test record ID for recordId, and run it with good and bad inputs. My walkthrough on how to debug a Salesforce flow covers reading the debug output.
  • Activate. Save, then click Activate. Editing later creates a new version that you must activate again.
  • Launch. Two common routes: a quick action of type Flow on the Account object (Object Manager, Buttons, Links, and Actions), or the Flow component dropped onto the Account record page in Lightning App Builder.
  • Access. Give users access to the flow through a permission set or profile, otherwise they'll see nothing or an error. Test with a user who isn't a system administrator.

Then check what the Task does next. If you have Apex triggers or record-triggered flows on Task, they run after your flow saves. The order of execution in Salesforce explains which runs when.

Common screen flow mistakes

Most broken flows share the same handful of causes, and all of them are avoidable.

MistakeWhat happensFix
No fault pathUser sees an unhandled fault with no guidanceRoute faults to an error screen showing {!$Flow.FaultMessage}
Validation formula written like a validation ruleValid input is rejected, invalid input passesThe formula must return true for valid input
Misspelled variable name (RecordId, record_id)The record ID never arrivesName it exactly recordId and tick Available for Input
Missing required fields on the created recordREQUIRED_FIELD_MISSING on saveCheck required fields on the object first (see the help page above)
Get Records or Create Records inside a loopLimits hit with larger data setsCollect records in a collection, then create once outside the loop. See governor limits
Previous button left on after a saveDuplicate records when users click backHide Previous on the final screens
Built straight in productionUntested flow in front of real usersBuild and debug in a sandbox first

Try this week

Try this week:

  • Build the "Log renewal risk" flow in a Developer Edition org or sandbox, with all three validation formulas.
  • Break it on purpose: add a required custom field to Task and watch your fault screen catch the failure.
  • Open one existing flow in your org and check whether Create and Update elements have fault paths.
  • Replace one paper or spreadsheet process with a flow, and measure the minutes saved per use.

Frequently asked questions

What is a screen flow in Salesforce?

It's a flow type that shows screens to a user, collects input and then creates, updates or reads records. It needs someone to start it and interact with it, which is what separates it from record-triggered and scheduled flows.

How do I create a screen flow?

In Setup, search for Flows, click New Flow and choose Screen Flow. Add a Screen element with input components, add logic and data elements such as Create Records, then save, debug and activate it. The steps above show a complete example.

How do I add validation to a screen flow?

On an input component, tick Validate Input, enter a formula and write an error message. The formula should return true when the input is valid. For example, LEN({!Risk_Summary}) >= 10 blocks summaries that are too short.

How do I handle errors in a screen flow?

Add a fault path to elements that can fail, such as Create Records, and connect it to a screen that displays {!$Flow.FaultMessage}. You can also send the message to an admin by email so failures don't go unnoticed.

How do users launch a screen flow?

Common routes are a quick action on an object, the Flow component on a Lightning record or app page, a utility bar item, or an Experience Cloud page. Whichever you pick, make sure the user has access to the flow, and use a variable named recordId to receive the current record's ID.

Want to put this to work in your business?

Join one of my live sessions, or tell me what you're trying to do with AI.

Newsletter

Get the next one by email.

New writing on Salesforce AI, AI agents and the AI-Native Enterprise. Confirm by email; unsubscribe any time.

Keep reading