Tag Archives: Lightning Experience

Coming Soon to Boostr: “View Offending PB or Flow” link in Lightning

In BOOSTR: VIEW FLOW OR PROCESS BUILDER CAUSING ERROR, the “View Offending Process Builder or Flow” link works in Salesforce Classic BUT not in Lightning Experience (LEX).

I implemented the Boostr code so now it will. A future release, coming soon, will have this functionality.

Technical Bits

This Boostr Pull Request shows how it’s implemented in Javascript.

High-level Algorithm

  1. If in Lightning Experience, add a mutation observer that reports whenever a DOM element is added or removed on the page.
  2. When the DOM changes, is the Flow Error text added?
  3. If yes, create the “View Offending Process Builder or Flow” link and append it to that error message node.

Why It Didn’t Work in Classic?

The reason is the way that Boostr for Salesforce works. When a Salesforce page is opened, it inspects which page is opened and adds the page specific features to it. For example, when the generic flow error is opened, it adds the View… link. It doesn’t look for changes to the page.

In Lightning, since it’s a Single Page Application (SPA), the page is loaded and then dynamically generated via Javascript. A new page isn’t opened when you click different links and buttons. You’re still on the same page but its contents change as different actions are performed. Since the generic flow error page is never loaded, that’s why the link never showed.

Have a feature you’d like to have in Boostr? Submit a feature request issue in GitHub and a contributor may implement it. Or you can implement it yourself by following the Contribution instructions.

Flows in Lightning Experience

Today I want to share some interesting “Flow Nuggets” I learned recently about using Flows within Lightning Experience.

Flows Are Usable In Lightning Experience

First, you can embed Flows onto Lightning pages using the Flow standard component which is currently in Beta. The Flow component can use Flows whose type is “Flow” aka Flows that have screens in them.

This allows for interesting use cases such as creating a wizard with a Flow on a stand-alone Lightning page. For example, perhaps you want to create a commission calculator wizard.

Note: They are also styled using Lightning so they look and feel like they belong in Lightning. Previously, they were, by default, styled as Salesforce Classic even though they could be embedded in Lightning with a Visualforce component and page.

How-To Steps

  1. Create an active flow whose type is “Flow”.
  2. In the Lightning App Builder, edit a page.
  3. Drag the Flow standard component onto the page and select the Flow to use.
  4. Configure any input variables as needed.
  5. Save.

Lightning Flows Can Be Record Aware

Lightning can pass the record’s id to your flow component when on a record page. If your flow has an input variable defined whose name is “recordId” and it’s embedded on a record page, Salesforce automatically passes the record’s id into your flow so you can use it.

This opens up other interesting possibilities such as:

  1. Creating Automated Flows When A Record is Opened. Technically, this isn’t supported but this could be a workaround where the flow queries the record first, does some computation(s), and then updates the record or other records.
  2. Since the flow has the record id, it can query any information from that record or related records and use that in a more context-sensitive way. For example, your commission calculator can now be embedded on your opportunity records and calculate your territory specific commission based on the opp’s products, the account executive’s commission rates and other variables.

Note: If you create an Automated Flow that updates the current record’s fields, those fields may not show the updated values because Salesforce doesn’t have a way, currently, to tell other components on the page from flows to refresh other components.

How to Run Flow from Page Button in Lightning Experience

Douglas Ayers Blog Post shows how one can use an Action button to open a Flow in Lightning to do other use cases. His example is another “Automated Flow” but it’s activated by a user instead of automatically when a record is opened.

What other ways have you used Flows in Lightning? What limitations have you come across?