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.
- Create an active flow whose type is “Flow”.
- In the Lightning App Builder, edit a page.
- Drag the Flow standard component onto the page and select the Flow to use.
- Configure any input variables as needed.
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:
- 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.
- 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?