Skip to content
Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Login Flows entry
How-to guide

How to set up a Login Flow

Build a screen flow, designate it as a login flow, and connect it to a profile so it runs at login. Test in a sandbox before you touch any production profile, and never attach an untested flow to your own admin profile.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated Jun 16, 2026

Build a screen flow, designate it as a login flow, and connect it to a profile so it runs at login. Test in a sandbox before you touch any production profile, and never attach an untested flow to your own admin profile.

  1. Build and activate the screen flow

    In Flow Builder, create a screen flow with the screens and logic you want at login. Read LoginFlow_UserId to identify the user, and use Get Records or Update Records to read and write the User record. Set LoginFlow_FinishLocation or LoginFlow_ForceLogout if you need to control the outcome. Save and activate the flow.

  2. Open Login Flows in Setup

    From Setup, type Login in the Quick Find box and select Login Flows. This page lists existing login flow connections and lets you create new ones.

  3. Create the login flow connection

    Click New. Enter a Name for the definition, choose the type (Flow for a Flow Builder flow, or Visualforce Page), and select your activated flow from the dropdown.

  4. Connect it to a license and profile

    Select the User License that matches your target profile, then select the Profile. The flow now runs for every login by users on that profile across web, mobile, and OAuth apps. Save the record.

  5. Test before going wide

    Test with a non-admin test user on the target profile in a sandbox. Confirm the flow runs, completes, and lands the user correctly before connecting it to broader profiles or production.

Typeremember

Flow for a Flow Builder screen flow, or Visualforce Page for a custom page with an Apex controller. Most orgs use Flow.

User Licenseremember

The license tied to your target profile. You pick the license first, which filters the available profiles.

Profileremember

The profile whose users run the flow. One login flow can be connected per profile at a time.

LoginFlow_FinishLocationremember

Optional output variable that sets where the user lands after the flow. It cannot point to a URL outside the org.

LoginFlow_ForceLogoutremember

Optional output variable that logs the user out immediately when set to true, used to deny access on a failed check.

Gotchas
  • A broken flow blocks login for everyone on that profile. Do not attach an untested flow to your administrator profile.
  • The flow does not run for API logins or sessions passed through frontdoor.jsp, and admins using Log in as another user bypass it.
  • In Lightning runtime, users may reach some Salesforce functionality before finishing the flow, so it is not always a hard wall.
  • The flow runs on every login for the profile. Branch early to skip work for repeat users and avoid adding login latency.

See the full Login Flows entry

Login Flows includes the definition, worked example, deep dive, related terms, and a quiz.