Skip to main content


How to Use Lightning Components in Flows & More

Woman at a computer

Flows in Salesforce, also known as Visual Workflows, are powerful tools that allow for the automation of various business processes without the use of custom code. The cloud flow designer allows you to build flows that execute logic, interact with Salesforce, call Apex classes and collect data from a user in screen elements. The Winter 18 Salesforce release brings even more functionality into Flows.

Here’s what you need to know about a few features available in this release and how to use them to create the very best flow automations in a low-code environment.

What’s New in the Winter 18 Release

The Winter 18 release is chock-full of amazing new features, and you can view the full list here. The features specific to Flows that I am the most excited about are the ability to use Lightning components in Visual Workflow Screens, embedding Flows in Lightning Communities and the ability to use Quick Actions to launch Flows.

Feature #1: Using Lightning Components in Flows

Using Lightning Components in Visual Workflow screens is the first – and one of the most exciting – features in this release. The ability to add Lightning Components in Flows means that a screen can contain a lot more than just inputs, choices and outputs. Plus, it’s extended to include Lightning component actions right in the flow, which previously could have only been achieved in all custom apps.

A few great examples of candidates for this new feature within a flow include:

  • A progress tracker
  • An alert message that appears when action is needed on a record
  • Record selector
  • Embedding a video
  • Displaying data

How It Works

Embedding the component in the Flow couldn’t be easier. Once you have a developed Lightning component, you can have it up and running in a flow in no time at all.

  1. Open the Flow screen you wish to add the Lightning component to.

  2. Drag the Lightning component field over into the screen.

    Adding Lightning Component Field

  3. Configure the Lightning Component Field Settings.
  • Name the component in the flow.
  • Select the Lightning component you want to use.
  • Define the Input and Outputs to set the component’s attributes with values from your flow.

Configuring Lightning Component Field Settings

4. Save the screen.

  1. Save the Flow.

  2. Activate.

After completing these steps, you’ll now be able to see and interact with the Lightning component in your flow. Below is an example of a record selection flow that allows users to narrow down their list of orders by Status, Keyword/Order Number and Order Date, as well as select the order they’d like to interact with in the list.

Activating Lightning Components creates a better user experience.

You can see how much better this user experience is compared to the past when it comes to displaying choices on a screen, which would have involved putting them in a drop-down and only being able to show one field as the label for that record. This is just one example of how a Lightning component can improve the flow experience.

Feature #2: Embedding Flows in Lightning Communities

The next exciting feature is the ability to embed flows in Lightning Communities. This means that a flow for your customers/partners (aka Community users) could be embedded in your Community and also used by agents internally. An example would be a flow that could be completed by a customer but also may need to be completed on behalf of a customer by a service agent. Think of the simplification if you could create one flow to do both, and add it to a record page in Salesforce and to a community.

(Beta) Feature #3: Using Actions to Launch Flows

The last feature of the release that I want to talk about is the ability to use Actions to launch flows. This is a Beta feature, and it’s terrific since JavaScript buttons are not available in Lightning. I don’t know about you, but in the past, I used JavaScript buttons in Salesforce classic to launch most of my flows, thus making them available on a record page and being able to pass in attributes from the record to variables in my flow. An action greatly simplifies this process of launching a flow from an object record page or mobile, not to mention the fact that it’s available in Lightning.

Creating the Action to launch the flow is very simple.

  1. Just navigate to the Object you would like to create the Action on.
  2. Select Buttons, Links and Actions.
  3. Then select New Action.
  4. In Action Type, select “Flow (Beta)”, select the Flow you want to run from the action.
  5. Give it a label and name, and save the Action.
How to create the action to launch Flow

Once this Action is added to the Page Layouts, you can click the Action on the record screen, and it will run the flow within the middle of the page. Also note that if your flow needs the ID of the record that it’s operating on, make sure to create a Text input variable called recordId, and Salesforce will send the record ID to the flow on that recordId variable.

Run Flow
Flow Example

When using mobile, the experience is much the same. The Action shows up in the bottom of the record page.

Mobile Run Flow
Mobile Flow Example

As you can see with these three Winter 18 flow features alone, the potential uses for flows increase exponentially. So get out there and process automate!

Any Questions?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Perficient Author

More from this Author

Follow Us