Use Einstein Next Best Action with Flow by Marc Baizman

Ever wanted to inject Einstein Next Best Action into your Flows? Check out this post by Marc Baizman.

Display a Picklist of Flow Names with the FlowList Control

FlowListFSC is a specialized combo box that you can drop into any flow screen. It displays a list of all of your flows, and can be configured to show just the active ones.

I built FlowCombo because I’ve been exploring orchestration of multiple flows to solve more advanced business problems. In this prototype I’ve been working on, each of the blue buttons represents a flow that is associated with the current Case status. Click on the button and the flow runs:

In order for this to be useful, it needs to be possible for admins to customize these ‘Case Plans’ to meet their own needs. This is done with a flow called Case Plan Manager, that includes this screen:

When designing the UI above, I was able to use picklists for a couple of the fields, but I didn’t have an easy way to show a list of flows, because flows are metadata, and not records.

To solve this, I’ve built a custom component that is based on the standard lightning combo box. When it initializes, it does an Apex query using the newly available FlowDefinitionView SObject. This did not get put into the release notes, except in a mention here, so it’s a little under the radar. I’ll post more on it later.

FlowListFSC takes the following inputs:

Supported attributes

label – field label;

selectedFlowApiName – if flow is selected, its api name is recorded in this variable, also component can be initialized if value is passed from parent component;

showActiveFlowsOnly(default=false) – if true, shows only active flow components;

required(default=false) – if true, field becomes required and component will throw an error on attempt to navigate to next flow screen;

showWhichFlowTypes(default='Flow,AutolaunchedFlow') – specifies flow types;

Developer Notes

The cmp file for my component passes an object called comboBoxOptionObject. It’s the job of the Apex controller FlowListController to take advantage of a brand-new Summer ’19 api for getting flow information.

The component has to carry out two key pieces of work:

  1. Use its Apex controller to make an SObject query to get the list of flows
  2. Transform the list of flows into the format expected by the base comboBox control.

At initialization time, the component quickly calls the associated apex controller:

Component javascript controller

Here’s the Apex controller. As you can see, all it really does is make a SOQL query and return the results. It also implements the Visualforce ‘special technique’ that’s used to get a SessionId:

The helper code does the work of converting the array of objects that comes back from Apex into the form expected by the combobox base control:

Finally, the component markup invokes the base control and defines the attributes:

And that’s it. Note that there are two other new resources, FlowVersionView and FlowVariableView, which let you drill down for details on a particular Flow or Flow Resource.

Old Versions

How to do more with Custom Permissions in Salesforce Lightning Flows by Scott McClung

DualListBox Flow Screen Component

This new component surfaces the dual listbox in flow screens. It allows for multiple selection and returns the selected values either as a comma-separated list or (more usefully) as a collection of strings that can be looped over.

This is an installable component and is not the same as the built-in Multiselect Picklist, which looks like this:

Dual Listbox expects two key pieces of data:

  1. The full set of all of the items that could be selected.
  2. The current set of items that are selected.

Unlike the Multiselect Picklist, the Dual Listbox does not (yet) directly accept picklist or multiselect picklist field types. It accepts data in two forms: 1) a comma-separated string or 2) a flow resource that’s a collection of strings.

Likewise, you can output the set of selected values as either a comma-separated string or a string collection variable, or both.

If you output the set of selected values as a comma-separated string, you can feed that string variable back into the input to support ‘Previous’ and make sure the selections are remembered when Previous is clicked. At the moment, a bug is preventing Previous support for use cases where you store the selected values in a string collection variable.

Update: July 2019

New attributes have been added to this component. You can now:

  • make input required
  • specify the minimum and/or maximum selections allowed by the user
  • set your own help text
  • set the vertical size of the component
  • disable reordering of the selected items

These attributes can be set in the “input” section when adding the component to a screen within a flow. If you have previously installed this component as an unmanaged package, you will need to reinstall the package. For any existing implementations, you can edit the component in order to supply values for the new attributes. If you’ve never installed the package, you can get it using the links below:

Displaying Map with markers in Flow screen using Lightning Components by Terence Chiu

UnofficialSF is Looking for Volunteer Editors

UnofficialSF is Looking for Volunteer Editors

Want to help the Flow community, work closely with Salesforce Flow PM’s and build your flow knowledge? Become an UnofficialSF editor. 

The general goal we have is to make this the best starting point for flow knowledge. That means tasks like adding links to the high quality flow content being created by the flowhana, such as Jen Lee’s recent article on Flow with encrypted fields, and Rakesh Gupta’s recent post on Local Actions, searching out new undiscovered flow content, culling out obsolete material, and more. 

UnofficialSF is a WordPress site and pretty easy to work with.

Don’t worry that you’re signing up for a big commit. Think of this more like a pool of volunteers that can choose to take on small tasks and drop out anytime.. 

Interested? Contact

Summer ’19 Flow Sneak Preview

Here’s a sneak peak at some of the things you’ll be able to start playing with in a couple of weeks (either via a new pre-release org or an early sandbox upgrade).

Keep in mind our forward-looking statement. Please make your purchase decisions based only on generally available product functionality.

The Flow Builder gets Undo, Redo, and Duplicate. As well it should.

You can find elements quickly. (We’d be very proud of this one if Cloud Flow Designer didn’t already have it.)

Rich Text is back. in black. and red. and bold. (Boy, we’re funny)

We added an image button that uploads and inserts images too.

There are a couple of limitations to be aware of:

  • The added images get created into the org as ContentVersion metadata, but can’t really be packaged with the flow because ContentVersion use id’s that are specific to an org. It will take more work to figure out a solution for that.
  • At the last minute we had to disable rich text in Text Templates because we need to do some more work to make sure the rich text you create doesn’t spew html into downstream plain text fields like the email body in the Send Email flow action. We’ll have that working next release.

The “New Flow” button now generates a New Flow dialog box that provides access to flow templates.

Watch for special flow template announcements at TrailheaDX in May.

The new Automation Home page

We have big plans for the metrics and tools we intend to make available from this new page.

Flow Support for Rich Web Objects (JSON)

Our most complex and powerful feature in Summer ’19 allows incoming JSON to be converted to rich objects that can be used declaratively in Flow.

Read the deep-dive post on rich web object support.

Actions have categories to make them easier to manage in large numbers.

We haven’t enabled custom actions to be tagged with categories yet, but that’s in the works.

Additional Enhancements

  • With the new $Flow.InterviewStartTime system variable, you can use the start time of the flow interview in Decision elements, formula resources, and elsewhere in the flow.
  • Dependent Picklist component can be set to Required.
  • Custom Metadata Type Records can be used in Process Builder
  • New Build Flows with Flow Builder trail at Trailhead.
  • Flow names and properties are now available via REST (This is useful for doing things like putting a picklist of flow names on a flow screen to let a user pick which flow to go to next). previously you had to use the metadata retrieve process)

Advanced Flow Navigation Button from GravityLab

Dan Howell and GravityLab have made available an advanced Flow Navigation Button with no fewer than 12 built-in features, including:

  1. Add bespoke navigation options in a flow. For example, replace the “Next” button with a “Save and View” button.
  2. Launch new record or edit page. For example, launch the create new account page with a specific record type.
  3. Auto launch a quick action. For example, automatically launch the new opportunity quick action when an account with the type “prospect” is created.
  4. Navigate to another page. For example, auto navigate to another record page when a certain status is reached.

Documentation and Installation

Part 1: Manipulate Rich Web Data in Flow Without Code (Apex-Defined Data Types)

Watch Intro Video

In Summer ’19, Flow gains the ability to manipulate the kinds of complex data objects that are typically returned from calls to web services. Using Apex Actions and External Service Registrations, Flow was already able to work with web data, but it had to be in the form of simple ‘primitives’ like strings and numbers. The problem with that is that data from the web and enterprise data retrieved via integration solutions like Mulesoft rarely is composed of nothing but primitives. Consider these snapshots of web data:

This Product data structure includes three different URLs and three different SKU numbers corresponding to the different sizes of the Product. Traditionally, you’d have to manipulate these data structures in code (or carry out transforms in Mulesoft’s developer-oriented Application environment). Flow’s new functionality provides a new option that requires no code, expanding the range of people that can work with these rich objects.

To demonstrate this, we’re going to build a Flow that takes that complex Mulesoft product data and breaks it up into three separate Salesforce product records.

Setting Up: Creating Mulesoft Actions in Flow

For our particular example, we’ll start with a Mulesoft endpoint that produces this JSON:

  "identifier": "1295527d-d3c7-11e7-9c84-06bf056d193e",
  "identifiers": [
      "SKU": "LN-2230"
      "SKU": "LN-2232"
      "SKU": "LN-2231"
  "price": {
    "amount": {
      "currencyValue": "24.00",
      "name": "Amount",
      "currency": "USD"
    "salesUnit": {
      "code": "EA",
      "name": "Each"
  "description": "Lion Mane costume hat for cats and dogs SMALL: Best fits slim cats and kittens. Neck circumference 22-26cm LARGE: Best fits most cats or small dogs. Neck circumference up to 35cm",
  "model": "Lion Mane Costume",
  "brand": "SmartPets",
  "pictures": [

This data is returned by a Mulesoft application that you create by following the Mulesoft Quick Start. However, you can use one that I set up already. To test your connectivity out, open a terminal program and run:

curl -X GET

If things are running correctly, you should get back the JSON shown above.

However, we want to access this data inside of Salesforce and inside Flow in particular. The first thing we’re going to do shows how this is done before now. I’m going to create an Apex Class that calls this same URL.

This class defines an Invocable Action by making use of the @InvocableMethod annotation. It also uses the Requests & Results pattern that’s described here. You can get an introduction to Invocable Actions here.

If we go to Flow, we can now easily find that action by dragging the Action element onto the screen and searching for it by name (Note the new Summer ’19 simplified palette).

Getting The Data To Salesforce From The Web

The basic way to get data from the web into Salesforce is via an Apex class. Notice that this class parses the response JSON into an Apex object called a WebProduct:

global with sharing  class GetWebProductViaMulesoft {
    public static List<Results> GetWebProductViaMulesoft(List<Requests> requests)
            Http http = new Http();
            HttpRequest request = new HttpRequest();
            String endpoint = requests[0].endpoint;
            String submittedId = requests[0].submittedId;
            System.debug('url is: ' + endpoint + submittedId);
            request.setEndpoint(endpoint + submittedId );
            HttpResponse response = http.send(request);
            Results curResult = new Results();
            String responseJSON = response.getBody();
            //this particular Mulesoft endpoint returns json that includes as a keyword 'currency',
            //which is a disallowed reserved word in apex. So we need to transform it to something else before we can parse it
            responseJSON = responseJSON.replace('currency"', 'currencyType"');
            WebProduct curProduct = WebProduct.parse(responseJSON);        
            curResult.WebProduct = curProduct;
            List<Results> resultsList = new List<Results>();
            return resultsList;
    global class Requests {
        global String submittedId;
        global String endpoint;       
    global class Results {
        global WebProduct product;


Where did WebProduct come from? We created it by converting the JSON into Apex. To use rich web data in flow, you take the initial json and create an Apex representation of it:

Taking the JSON response from above and pasting it into the excellent tool at JSON2Apex, we get the following Apex:

Our GetWebProductViaMulesoft Apex class can get a rich web object from Mulesoft, turn it into Apex objects and work with it in code. Since we want to go farther and work with it Flow, we need to do 2 pieces of post-processing:

  1. Add the @AuraEnabled annotation to each property that we want to be present in Flow.
  2. Move each of the inner classes, such as Identifiers and Amount, into their own files.

Once this is done, we end up with five individual small class files like this:

By doing this work once, you subsequently can create many different Flows that work with this incoming data.

We’re setup to work with this endpoint via Flow. We’ll do that in Part 2.