Flow Components has the ability to use a Lightning Component to launch a Flow through the click of a button. Launching a Flow through a button prevents the Flow from auto running when a record is loaded.

Using Lightning App Builder, you can find the Run Flow Button Lightning Component in the Custom – Managed Components section.

Once you drag it and drop it onto the page, you’ll be able to configure the component. The parts that you can configure are:

  • Button Label
    • This is what will display to the User as the button
  • Flow Name
    • This is the API name of the Flow
  • Title
    • This is optional. If you want to display a title to the Lightning Component card background, you can enter the text here.
  • Reload Flow When Record Refreshes
    • If this is checked, if the Flow has started and the Record has been updated after, it will refresh the Flow to start again.
  • Reload Button When Flow Finishes
    • If this is checked, when the Flow finishes, instead of staying on the default screen that lets the user know the Flow finished, it will reload the button to allow a User to start again.
  • Refresh Record When Flow Finishes
    • If this is checked, after the Flow finishes, the record will refresh and will display any updated information as a result of the Flow.

8 comments

  1. Hello, I’m using this button on a community page in conjunction with a simple ‘quick case creation’ flow that I have. The button shows up fine, but has an issue with starting the flow, showing an error message when clicked that is referencing a variable that doesn’t exist in the flow:

    “The value null is being provided for variable recordId but isn’t compatible with the variable’s data type (String). Check the places where you implemented the flow ā€’ such as through a Lightning page or a custom button ā€’ and make sure that all provided values are compatible with the variables’ data types.”

    The ‘recordId’ variable is not in my flow, and I can’t figure out why it would be referencing that. When I run the flow without the button, it works just fine and shows no error, so I’m wondering if there is something about the button I may be missing that you could help me with. Thanks in advance for your time!

    1. Hi Annabelle,

      Can you create a variable, recordId (with the capitalization like that), as a text input variable? The button passes the record id of the record, so if there isn’t a way to receive it, that could potentially be the problem. Even if you don’t use it in the flow, it might help. If that doesn’t work, please let me know, thanks!

      Rich

      1. Hi Rich, this worked perfectly! Thanks so much for your quick input, this component just solved a huge problem for me!

        Best, Annabelle

  2. Hi Rich, unfortunately I may have spoken too soon – while the flow now works in my ‘preview’ of the community, the changes are still not working on the user end when I try it there, and I get the same error. I tried adding in a ‘default’ value of a dummy recordId, but that didn’t work. Any other suggestions? I appreciate your time.

  3. If it helps, I just tested the button with flow in a regular lightning page and it DOES function properly there. It’s only not working in the Community. Any insight would be appreciated but I understand if it just may not work there.

    1. Hi Ben,

      You don’t need to redirect with the Run Flow Button. There are settings in the lightning component itself to reload button when flow finishes and refresh the record when flow finishes, that should be enough if you’re staying on the same record.

      Rich

  4. Yes sir, but it complains about not getting a recordId passed in if it’s on a community page. I just couldn’t get around that bit. Otherwise it’s an amazing thing.

Leave a Reply

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

%d bloggers like this: