Dynamic Launching of Screen Flows

Suppose you have 20 screen flows representing 20 different business processes, and you want to dynamically determine which one a user should be brought to. One way to do this is to have a master flows with 20 subflows and a big decision element. That’s a little inflexible, though. Each time you add or delete something you have to change the master flow. And managing the big decision element takes work that it would be nice to be able to avoid.

Let’s look at a different approach.

Get the demo flow from the video, including the Flow List FSC picker and the Open URL Flow Action here.

The sample Flow we use in the above video incorporates two components:
1) a Flow List component provides users with a list of flows to choose from.
2) A new Open URL Flow Action launches the chosen screen flows by URL.

Of course, you don’t have to leave the choice of flow up to the user who is running the flow. You can generate the name of the flow to launch via your own flow logic.

New Ways to Open Web Pages from Flow

The new OpenURL Flow Action allows a URL to be opened by your Flow. It runs everywhere, unlike the Load Web Page Flow Action.

This action allows the URL to be opened in three modes:

  • newTab: Opens in a new tab in the browser
  • newPage: Opens in a new browser window
  • replace: replaces the existing flow, effectively terminating it

Install Package

Source Code

Use one of the above strings as an input to the ‘mode’ parameter. The default is ‘newTab’.

This action uses popup technology and may get blocked by popup blockers. If that’s becoming a problem for you, consider the alternative Load Web Page action.

Protected: Adding a Manual Sharing Button to Records with Lightning Flow

This content is password protected. To view it please enter your password below:

Winter ’20 Flow Preview by Brian Kwong

Good analysis of some of the new features: https://thewizardnews.com/2019/09/12/7-winter-20-lightning-flow-builder-features/?utm_source=trailblazer&utm_medium=social&utm_campaign=WizardApprentice

Send Rich Email with the new SendHTMLEmail Action

Video introduction

Installation (See bottom of post)

Source code

Flow provides a built-in Send Email action but it’s something of an underachiever. However, using the power of Apex and Flow Actions, its possible to build a powerful SendHTMLEmail action that can be easily installed and used from within Flow Builder. MVP Jeremiah Dohn pioneered this space several years back with his well received HTML Email Flow action. The version here is similar and adds a couple of additional capabilities.

This improved email experience provides:

Rich, HTML email bodies that can use all of the capabilities of Flow’s Text Templates, including Bold, Italics, Underline, Bullets and Numbers, Left/Center/Right justification, URLs, images, fonts, and text size:

This action also allows you to use Email Templates (both Classic and Lightning), so long as you provide it with a recordId to a Contact, Lead, or User that can be used to fill in the merge fields of the template:

To make it easy to pass email addresses into the action, it supports any combination of the following, for To, CC, and BCC:

  • A single email address
  • A string collection of email addresses
  • A collection of Contacts
  • A collection of Users
  • A collection of Leads

Other supported features include:

  • Support for Organization-Wide Email Addresses
  • Support for Attachments
  • Ability to toggle on/off the use of the Salesforce per-user email signature
  • Ability to provide either a plain text body, an html body, or both
  • Ability to set the ReplyTo email address and the Sender Display Name


This sample flow ships with the action and can be used to test and demonstrate the action:

Here’s how I have my inputs configured in the above sample Flow for an HTML body from a Text Template:

Here’s how it would be configured for use with an Email Template. Note the plainTextBody, HTMLbody, and Subject are all nulled out (when “Don’t Include” is selected, null values are used):

You can use any of these five combinations:

  • An HTML Body
  • A plain text body
  • Both an HTML Body or a plain text body
  • A Classic Email Template
  • A Lightning Email Template

However, you’ll get errors if you try to mix your own bodies and subjects with Email Templates.

Using Templates

If you want to use an Email Template, you must pass in the Id (not the name) of the template. In the above flow example, I use a Get Record to query for an email template by name, and then pass in the ID to the SendHTMLEmail flow action. Importantly, you need to also pass in the recordId of a Contact, Lead, or User that will serve as the context record for the template and populate the template’s merge fields. Do this with the templateTargetObjectID parameter

Setting the Sender/ReplyTo Address

You can either 1) use an OrganizationWideEmailAddress or 2) specify your own Reply-To Email Address and Sender Display Name. If you provide an OrganizationWideEmailAddress, that will take precedence and any Reply-To Email Address and/or Sender Display Name you’ve also provided will be ignored.

To use an OrganizationWideEmailAddress , pass the Id of one that you have defined into the action via the “Use This Organization-Wide Email Address Id”. (If you want to get the benefit of Verified sending, you can’t just paste the email address into the Reply-To Email Address field. You have to use the Use This Organization-Wide Email Address Id field.). to find the ID:

  1. In Lightning Setup, go to Organization-Wide Addresses and click Edit on the address you want to use:

2. Examine the URL of this web page. It should look something like this:


3. The Id of the Organization-Wide Email Address is the character between the 2 “%2F” strings. So in the example above, you would extract “0D2560000008PGP” and insert it as an input:


You can pass in a collection of Attachments. In many cases, though, you’ll be working with Content Document Links that you’ve retrieved with a Get Records. This package also includes therefore an action called ConvertFilesToAttachments that takes a collection of Content Document Links and returns a collection of Attachments. For more information on the relationship between these various document-related types, see this.


This action makes use of the standard Salesforce email infrastructure, the same service that you use when you send a single email directly from a lightning experience page or a classic case feed. As such, any emails you send will be included in your usage, so be aware of the limits and guidelines. (Developer note: this action makes use of the Apex Messaging service API’s.)

This action does not use or involve Email Alerts, which are used in Workflow Rules and exist in Flow as separate actions you can drag into your flow. Be mindful of this so you don’t accidentally confuse the Email Alerts, the Email Templates, and the Flow Text Templates.

Currently unsupported features include:

  • Support for the MassEmailMessage API, enabling higher volumes
  • Character Set setting

If you’re interested in extending this class, please do so!


  • Install – 1.1 Unmanaged (adds Attachments and Organization-wide Email Addresses

Old versions

1.0 Unmanaged

1.0 – Managed (requires Winter ’20)

Submitting multiple records to Flows by https://bigassforce.com

The admins at https://bigassforce.com wrote a blog on how you can create a list button that launches a flow and pass the selected record ids to be processed by the flow using an undocumented flow variable

How to validate custom Flow screen components in Flows by Narender Singh

Narender Singh form https://forcepanda.wordpress.com posted a series of blogs on how to add validation to custom flow screen components:

Part 1 https://forcepanda.wordpress.com/2019/07/09/how-to-validate-custom-flow-screen-components-in-flows-part-1/

Part 2 https://forcepanda.wordpress.com/2019/07/11/retain-input-values-while-validating-custom-flow-screen-lightning-components-part-2/

Part 3 https://forcepanda.wordpress.com/2019/07/12/adding-validation-errors-on-individual-inputs-in-custom-flow-screen-components-part-3/

The New Lookup Component

In Winter ’20, Flow adds a Lookup Component.

This component includes type-ahead search, and a list of recently chosen records. Here are the input parameters that you can pass in to it:

You configure it by pointing it at an existing Lookup field using the Object API Name and Field API Name fields. If you want to set its initial value, you can pass in a recordId, and you can make the field required.

Using Lookup Filters

You can make use of Lookup Filters with Lightning Flow. The filter does not (unfortunately) act before the list is rendered for the user. Instead it acts when the corresponding record is saved. Let’s walk through an example:

My Ships__c custom object has a Captain__c custom field that’s a Lookup to Contacts:

The Lookup control used on Flow screens is the same one used on Lightning record pages. Here’s what it looks like on a Lightning record page:

…and here’s how it looks on a Flow screen:

Suppose I add a Lookup Filter that filters out David Green:

One thing to note is that caching may cause it to take several minutes for the lists to update. I had to wait about 10 minutes after creating this Lookup Filter before David Green disappeared from the lists. However, effective immediately, if I selected David Green and tried to save the record in either a record page or via Flow, I would get an error message like this:

Once any caching refreshes, though, values that are blocked by the filter will not be visible in the Lookup

Winter ’20 Flow Preview!

I’m pleased to report on the great things the Flow team has built over the Summer. These Flow Previews have become my favorite blogs to write because there are so many goodies to disclose. If you want to try these out immediately, get a free preview org.

Scheduled Flows

It’s now possible to schedule Flows to run on a schedule. This applies to “Autolaunched” flows (i.e. flows without screens). Double-click on the Start element to set the schedule:

Notice that you can also add a record query. At the scheduled time, Flow will run the query and then run the Flow for each returned record, providing a powerful new batch mode capability.

Conditional Field Visibility

Fields can now appear and disappear on the screen as a result of some other field or value.

This is controlled via this new section in the field property editors:

Operator Note: If you’ve just created a field, you have to close the screen and reopen it before that field can be used as a ‘parent’ field. Yes, we think this is annoying too and we’ll fix it next version (this is one of those ‘harder than it looks’ caching yadda state storage yadda yadda problems).

Automatic Output Handling

The Automation group at Salesforce is in the early stages of a multi-release campaign to simplify the process of creating Flows. This will touch nearly every part of the product. One of the first benefits harvested from this can be seen in a change to the Get Records element. As you’ll recall, when you query for a record or a collection of records, Flow requires you to define a variable of the same type to temporarily store the information. That is done here:

You then use the storage variable when you refer to the queried records in a downstream element, like this:

In Winter ’20, you no longer have to do this. The streamlined Get Records looks like this:

Automatically generated references for Get Records queries look like this:

and automatically generated references for Screen Components look like this:

Operator Notes

  • To access the ‘old way’ of doing things, click the new Manually assign variables checkbox at the bottom of the property editor.
  • Existing flows are not converted. For them, the “Manual” checkbox is checked and your existing variables and mappings remain unchanged.
  • You can convert an existing Flow to use automatic output handling by unchecking the “Manual” checkbox, but we’ll put a big warning message up, because you’ll have to fixup any downstream references that use your old variables.
  • In Winter ’20, we implemented support for this in two places: Get Records (as shown above) and Flow Screen Components. We’re working on extending this support to the remaining parts of Flow Builder that currently require manual variables.
  • In a future release, we’re going to continue to improve on this by eliminating the entire “Select Account Fields to Store in Variable” section as well.

Flow Screen Components Built with Lightning Web Components

Lightning Web Components is Salesforce’s new framework for creating fast, reusable components. Flow already has a growing set of custom screen components built using the previous Aura technology, and those will continue to work. We’re advocating that all new development of components be done in the new Lightning Web Component technology, though, and you’re going to start to see new functionality that is only available to Lightning Web Components and not to ones built in Aura.

We’ve published a blog post here that consolidates all of the important information about creating and using LWC-based Flow Screen Components.

Lookup Screen Component

It’s now easy to add a Lookup field to flow screens:

This component includes type-ahead search, and a list of recently chosen records. Here are the input parameters that you can pass in to it:

You configure it by pointing it at an existing Lookup field using the Object API Name and Field API Name fields. If you want to set its initial value, you can pass in a recordId, and you can make the field required.

Canvas Usability Enhancements

Enhancements to the canvas include:

  • Changes to Panning Behavior – Panning is now done by simply clicking and dragging the canvas around. You no longer need to enter a “Panning Mode”.
  • We’ve added the ability to drag-select multiple elements. Toggling the Drag-Select button switches from panning to selection mode. See below for an example:
  • Finally, you’ll notice in the above image, that each element has up to 2 lines of space for its name text.

Per-Profile Flow Permissions

You can optionally secure flow definitions on a per-profile basis.

New Flow List Page

We’ve refreshed the main list view in Setup.

Process Builder Enhancements

We made a couple of enhancements to Process Builder:

  • Process Builder can now trigger on Account Team Member changes. (Account Teams must be enabled in your org)
  • Some Process Builder actions can now use platform event payload data as inputs.
  • Use Process Builder with the new FlowExecutionErrorEvent platform event to generate custom notification schemes when Flow errors occur (see below).

Custom Error Message Notification Schemes

When an error occurs in Flow, a platform event called FlowExecutionErrorEvent is now fired, and you can subscribe to that event with a Process Builder trigger. This lets you use the power of Process Builder and Flow to generate custom error handling. For example, you could set things up so:

  1. If the flow error is coming from one of the Flows that start with “Europe”, send an email to Genevieve and Post to the EuroAdmins chatter group, else
  2. Generate one of those new custom notifications to my desktop, send me an SMS via a Send SMS Flow Action, and create a Case.

There are a few gotchas to keep in mind, and they’re discussed in detail here.

Fiddly Builder Things That Will Make Some People Very Happy

  • You can now activate flows directly from the canvas.
  • When you create a New Resource from a property editor or dialog box, the resulting resource is autopopulated into the text field from where you started.
  • Text Templates now again properly support rich text, although you can now toggle to plain text if you are using the template as an input to something that requires plain text (like the current Send Email action)
  • There’s a new Send Custom Notification action. It’s fun. Try it.

Hope you enjoy! At HQ, we’re now digging into the next wave of enhancements for Spring ’20. See you at Dreamforce!