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.

10 comments

  1. Hello! I seriously appreciate your flow package! It has been very helpful. I am working in console navigation for my app. And when I call my case flow from a list button using this above method everything works. However, when the redirect occurs, the original tab that was opened using the flow url does not close. The redirect happens but now I have two screens open. The one for the redirect and the original one where my flow is displayed.

    Is this expected or can I do anything to close the flow tab once the redirect occurs?

    Thanks!

  2. Can you provide more direction for how to use this: /lightning/cmp/ecflc__RunFlowFromURL?c__recordId={!recordId}&c__flowName={FlowName}

    What do I install, how do I configure it? What type of flow is required?

    I have a Custom Button that calls a screen flow. I am currently passing the record id to the flow through a Custom Button. As you explain above, I believe this is the reason your component ” Flow Components Redirect to Id or Redirect to URL” is not working. So I tried this url in my custom button (see above) but got an error message that the flow could not be found or does not have an active version. Thanks for your help.

  3. I left a comment for you early, but I got your component to work, so I no longer need help! It is great!!

    I tried to used this format exactly as given, but now I know (based on the image you provided above) that the flow name should not be in brackets:

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

    I also learned that I can’t name my own input variable. I have to use your variable name.

    Plus, since my ‘redirect’ record is another object, I have to use the url redirect vs the record redirect using this format: /{!recordidvariablename}.

    Now it works perfectly. I really appreciate your help.

    1. Hi Nina,

      I’m so glad that it works! I do hold comments and approve them to reduce spam, so sorry that it took longer to approve than you were able to get it to work! Thanks for the feedback for others that read this in the future, it will help for sure!

      Rich

  4. Hello! Can we pass other variables into the flow via the URL using this method? I tried adding &c__myVariable=value to the end of the URL, but it doesn’t look like that works.

  5. The flow I’m attempting to set this up on currently used the ids variable. The goal is for the users to select the related records they need to update, guide them through some screens and return them back to the parent record when complete. Is there any way to utilize that ids variable or create a new variable that can pass the records selected from the related list?

      1. Worked out perfectly! I was able to combine this with your redirector to get exactly what I needed.

Leave a Reply

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

Discover more from Englhard Consulting LLC

Subscribe now to keep reading and get access to the full archive.

Continue reading