I have a button "Manage RA" in Lightning Listview of a custom object which uses Visualforce page and Lightning:out to invoke the lightning component. When a user selects any of the records from the listview and clicks that button "Manage RA", the Id of the selected records has to be passed from visualforce page to LC. Please find my code.

VF Page:

    <apex:page standardController="Custom__c" recordsetvar="Customs" extensions="CustomController">
<apex:includeLightning />

<div id="lightning" />
<script src="https://tvds.my.salesforce.com/lightning/lightning.out.js"></script>
    $Lightning.use("c:ManageRAApp", function() {
          "customList" : {!customIds}
      function(cmp) {


Apex class:

public class CustomController{
ApexPages.StandardSetController ssc;
public list<Id> customIds{get;set;} 
public CustomController(ApexPages.StandardSetController controller) 
    this.ssc = controller;
    this.customIds= new List<Id>();
    for (Custom__c t : (list<Custom__c>) ssc.getSelected())


Lightning App:ManageRAApp

   <aura:application access="GLOBAL" extends="ltng:outApp" >
   <aura:dependency resource="c:ManageRA"/>

Lightning Component: ManageRA

   <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction,flexipage:availableForRecordHome,force:hasRecordId" access="global">
<aura:attribute name="customList" type="List"/>

<aura:handler name="init" action="{!c.init}" value="{!this}" />

Lightning Component Controller:ManageRAController

   init : function(component, event, helper) {
    var titles = component.get("v.customList");
    console.log('titles in int-->'+titles);

When I goto the Listview of Custom__c object and select any of the record and clicking on ManageRA button, I am getting error as "Lightning out App error while loading the App : a0O0j0000061xxxXXX is not defined".

a0O0j0000061xxxXXX is the ID of the record which i selected from the Listview.I am not able to figure out what is the issue. Could anyone please help me?

2 Answers 2


Direct list you cant pass. But there is a alternative.

  1. Create a string type attribute in your lightning component called customListStr

  2. In your VF page controller create a attribute of type string lets say customIdsStr

  3. In your VF page apex controller set the customIdsStr = JSON.serialize(customIds);

  4. Change the line "customList" : {!customIds} to "customListStr" : {!customIdsStr}

  5. Now you received your Id list as a string in your lightning controller. Now you pass the same string to apex and desrialize it like below and add to your list:

    List cObjMap = (List) JSON.deserializeUntyped(customListStr);

        for(Object obj : cObjMap){
            Map<String,Object> objectMap = (Map<String,Object>)obj;
            // using the get method of map get the Ids and add to your list.

You need a JSON string for this technique to work. There's just a few lines you need to change.

// Will ultimately be a JSON string
public String customIds{get;set;} 


// Create a list, then...
Id[] recordIds = new Id[0];
for (Sobject t : ssc.getSelected())
// ... serialize to a JSON string.
customIds = JSON.serialize(recordIds);

This should render your output as follows:

"customList": [ "aXX000000000...", "aXX0000000...", ...]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .