Calling a Flow from a button through a URL link has been something that has been available in Salesforce for a while now. Using the URL runs the Flow in classic mode, but you can extend to Lightning through Enabling Lightning Runtime for Flows. This, however, does not work with the Lightning Navigation Service, and as a result, the ability redirect the Flow to a record that was created inside of the Flow or control the navigation is not easily done.

With Flow Components Winter 21 release, we’ve created a Lightning Component that you can call via URL that will start your Flow. As it is a Lightning component, it works with the Lightning Navigation Service, allowing you to be able to use the Flow Components Redirect to Id or Redirect to URL.

In order to call the Flow, you create a button like the one below, where recordId is the recordId you want to pass in and flowName is the name of the Flow.

/lightning/cmp/ecflc__RunFlowFromURL?c__recordId={!recordId}&c__flowName={FlowName}

Additionally, in your Flow, even if it is not used, you need a variable, named ids, that will allow for input. The variable should be a text input variable and it can be a multiple records input, like the one for the Related List Button.

Without this variable, you might see an error message similar to the below error message.

And that’s it. Now you can use Flow Components Redirect to Id or Redirect to URL with your URL launched Flow.

Leave a Reply

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

%d bloggers like this: