function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hjalti Hannesson 6Hjalti Hannesson 6 

Unable to pass ids to Flow from List View after enabling Lightning runtime for flows

I've got an Account screen flow which is launched via a URL button on the Account list view.

This flow gets ids without issue if the "Enable Lightning runtime for flows" is not checked/enabled.

However, I want to use a LWC component in the last screen of the flow to automatically open a record the flow creates. To be able to use LWC in the flow, I need to enable the "Enable Lightning runtime for flows" setting.

Is there another way to pass list view ids into a flow that are known or do I need to switch to a aura component?

Arun Kumar 1141Arun Kumar 1141
Hi Hjalti,

There are a few options you may think about if you wish to pass list view IDs into a flow while utilising the "Enable Lightning runtime for flows" setting:
- When launching the flow, you can give the IDs as URL parameters rather than relying on the flow to fetch them. Create the URL button on the Account list view with the IDs as parameters, then use the "URL" variable in your flow to fetch and handle those parameters.

- Custom Aura or LWC Component: You can make a custom Aura or LWC component that encapsulates your flow and takes the list view IDs as attributes if you choose to use LWC components within your flow. In this method, you may launch the component with the IDs already there, access those properties within the component, and then feed them into the flow.

The following is an illustration of how to transfer the IDs from a unique Aura component to a flow:

<!-- MyFlowWrapper.cmp -->
<aura:component>
    <aura:attribute name="listViewIds" type="String[]" />
    <lightning:flow aura:id="myFlow" />
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
</aura:component>


// MyFlowWrapperController.js
({
    init: function(component, event, helper) {
        var flow = component.find("myFlow");
        flow.startFlow("MyFlowName", {
            inputVariableName: component.get("v.listViewIds")
        });
    }
})


In this illustration, the flow receives the listViewIds property as an input variable.
Ensure that "MyFlowName" is changed to the real API name of your flow.
The list view IDs should be passed into your flow using these methods, even if you are using the "Enable Lightning runtime for flows" configuration, and you shouldn't have to switch to an Aura component unless it is absolutely necessary.

Thanks
SubratSubrat (Salesforce Developers) 
Hello Hjalti ,

If you want to pass list view IDs into a flow when the "Enable Lightning runtime for flows" setting is enabled, you can use the following approach:

Create a Lightning Web Component (LWC) that will be used as the entry point for the flow. This component will be responsible for extracting the list view IDs and passing them to the flow.

In your LWC component, you can use JavaScript to retrieve the selected record IDs from the list view. You can do this by utilizing the lightning/uiListApi module -> https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reference_lightning_ui_api_lists_ui

Once you have the selected record IDs in your LWC component, you can use the lightning/navigation module to navigate to the flow and pass the selected IDs as parameters. The flow can then access these parameters and perform the desired operations.

Using this approach, you can leverage the capabilities of LWC within your flow and pass the list view IDs as parameters to perform the necessary actions. This eliminates the need to switch to an Aura component just to pass the list view IDs into the flow.

If this helps , please mark this as best answer.
Thank you.
Shuvam PatraShuvam Patra
With Lightning, you can't directly pass parameters into a Flow via URL. But there's a workaround for this: You can create an Aura or LWC that acts as a "middleman", takes in the parameters from the URL, and then launches the Flow with those parameters. This way, you can maintain the functionality you need while still having the benefit of Lightning runtime.