Passing a List from Lightning Flow to Aura component

    Hi Guys,
    Have you ever encountered the below error while passing a List as an attribute from lightning Flow to an aura component:
    OR you want to know how to pass a list from Flow to an custom Aura component.
    If yes below we will show how to work around that error to pass the list. 
    Basically if you give the attribute Type="List" in the aura component and use the attribute in design component to expose to the Lightning Flows you will receive the above error. The simple solution to overcome the problem is to use an array type instead of a list type. 
    For example if you want to pass a List<Account> to the Component to customize your solution, all you need to do is just pass the List as an Array and use Account[] in the type definition of the attribute.
    Author: Rahul Khurana
    Below is an example of the usage:
    <aura:component implements="lightning:availableForFlowScreens" access="Global">
        <aura:attribute Name="AccountListFromFlow" type="Account[]"/>
        <lightning:select name="AccountList" label="Account List" required="true">
            <aura:iteration items="{!v.AccountListFromFlow}" var="eachAccount">
                <option value="{!eachAccount.Name}" name="{!eachAccount.Name}">{!eachAccount.Name}</option>
    <design:component label="Account List">
       <design:attribute name="AccountListFromFlow" label="Account List" />
    Usage in Flow:
    Comment below your thoughts or if you face any issues and need help with the Solution. Happy Learning!!


  • (no comments)

Post Comments