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
Sanjana Rajasekar 9Sanjana Rajasekar 9 

Flow to LWC

I am trying to pass Record Collection Variable from Flow to LWC.  But in the flow, not able to pass the collection variable as input to lwc.  I can see the values in the screen .  Can someone help me to understand what I am missing here?
Collection Variable Values are : [01u0P00000, 01u0P00000,01u0P00000kj]
User-added image
    <targetConfigs>
        <targetConfig targets="lightning__FlowScreen">
            <property name="selected_products" label="Selected Products" type="String[]"/>
        </targetConfig>
 </targetConfigs>
Sai PraveenSai Praveen (Salesforce Developers) 
Hi ,

Can you share the screenshot of how you are adding the values into this variable and is the variable accepting mutiple values of type text?

Thanks,
 
Sanjana Rajasekar 9Sanjana Rajasekar 9
Hi @Sai Praveen
The Record Collection variable is of type Record.User-added image
I am using a data table component in a screen where It list the products. The selected products are storing it in collection variable.User-added image
When I print the collection variable, I am getting the IDs of the selected products. 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sanjana,

I don't guess it will work because you are defining in lwc as type="String[]" so it only accepts record collection of type string. Can you create that variable and add those ids to the variable and assign it.

Thanks,
 
Sanjana Rajasekar 9Sanjana Rajasekar 9
Can you ellaborate?
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sanjana,

In the LWC you have defined the selected_products variable as String[], But you are passing RECORD[] from the flow. You have to create a variable of type String which accepts multiple variables and add the recordids to that variable. 
I hope you got the issue now.

Thanks,
 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sanjana,

Are you able to get how to add the record ids to the collection variable?

Thanks.