Launch Screen Flows Automatically When a Record Changes with ‘Detect and Launch’ Page Component
This Post was most recently updated on 1/14/23
Credits: Derek Camp from GearsCRM : we can now pass the recordId to the Flow
Credits: Andy Haas for adding conditionality and proper support for the onLoad event.
Suppose you have a screen flow that you want to automatically launch whenever you’re on a record page and the record changes. Most likely, this will be because the user just edited the record. As an example, suppose you want to make it so that every time a Case is edited and its priority changes, a screen flow runs that asks the user to provide some extra reasons if the priority has been raised to ‘High’.
This new DetectAndLaunch component makes this easier. It’s designed to sit invisibly on a page and listen for an event that gets fired by Salesforce when a record changes. Simply provide Detect and Launch with the name of the flow you’d like to run. It will load the flow into a subtab if the app is in console mode, and a separate browser tab or page if the app is not in console mode.
Launch Conditions
By default, the flow will launch on every change to the record. However, you can refine that and make the launch dependent on a particular field value change. Example: you need an agent to fill in specific details when they close a case or your sales reps need to send a quote to the customer you can launch a flow after a specific field has changed and, for example, is equal to true. See ‘Conditional Screen Flow Launch Based on a field edit’, below.
You can set the record to run a screen flow on an Edit, a Delete, or every time the record is loaded.
Demos
This demo was produced for V2.0 and shows Conditional Launch Based on a Field Edit:
Triggering a screen flow when a record page loads
Perform this with the new input field ‘Flow Name (when the record is loaded)’. You can use this to launch the flow when the record is opened. Note that if you are using Launch Mode = Modal, you will need to build a close function within the flow, as the modal doesn’t have a close function, yet.
Conditional Screen Flow Launch Based on a new Field Value
Let’s say you have a case record that you want to launch a flow when the case is closed to get the user to enter the amount of time that they spent on the case. To configure this within Detect and Launch, enter the flow name you want in ‘Flow Name ( when the record is edited )’, set Change Field to ‘Status’, and set Change Value to ‘Closed’.
Want to check multiple fields and launch different flows based on them? Or run different flows depending on the value of the field? Add multiple Detect and Launches with different criteria to launch different flows.
Example Configuration

Limitations
This component uses the force:recordData component and that component doesn’t support all Salesforce standard objects. For example, the Event and Task objects are not supported. For a list of supported objects, see the User Interface API Developer Guide.
Inputs
Flow Name (when Record is edited) | editFlowName | The apiName of a flow you want to launch when the record is updated. Will work if this component is added to a record home page. |
Flow Name (when Record is deleted) | deleteFlowName | The apiName of a flow you want to launch when the record is deleted. Will work if this component is added to a record home page. |
Launch Mode | launchMode | Can be ‘Modal’ or ‘Modeless’. Modeless is the default. Modal only works on an edit and not on a delete. |
Change Field (What Field To Watch For) | Change Field | Is used to signify what field you want to watch when a record has been edited. Used only with editFlowName |
Change Value (What value are we looking for) | Change Value | Used to be the comparison value when the record has been edited. |
Flow Name (When Record is Loaded) | Flow Name (when the record is Loaded) | Use this to launch the flow when the record is opened. |
Install
V2.2.1 : 2-8-23 Production Sandbox Bug fixes
Source
Old Versions
V2.2 : 1-14-23 Production Sandbox Properly supports the Load event
V2.1 1-12-23 Production Sandbox Properly handles boolean (checkbox) fields
Version 2.0 Production Sandbox 9-10-22 Conditional Field-based Launching
Version 1.2.1 Unlocked – 7/9/21 – Derek Camp, GearsCRM
Passes the recordId value to the Flow
Version 1.2 Unlocked 12/26/20
Changes referenced field name from Subject to Id
Version 1.0.0 Unlocked 8-29-20