Able to pass lightning component values to server side. But passed Ids are not working in server side

For ex: caseIDStr contains values.Please check below image

enter image description here

But this is not building below query

   clist=[Select Id, 
CaseNumber,GSS_Business_unit__c,GSS_Support_Level__c,owner.Name from Case 
     where Id IN:caseIDStr];

Instead of caseIDStr IF i Hardcode Ids ,i will get the reults

I suspect that probelm caseIDStr, why its breaking


 <apex:page standardController="case" extensions="Gss_CsHelathCheckExtension"  
 recordsetVar="lstAllUserData" sidebar="false" showHeader="false">
      <apex:includeScript value="/lightning/lightning.out.js" />
<apex:includeLightning />
<div id="lightning" />
// alert(typeof "{!lstSelUserDataIds}");
   var  myList = '{!lstSelUserDataIds}';
   var tempmylist = myList.split(',');
//alert(typeof tempmylist);
    $Lightning.use("c:Gss_CloneSkillsToApp", function(){
            {"caselist" : tempmylist},


public class Gss_CsHelathCheckExtension {
ApexPages.StandardSetController setCon;
public String[] lstSelUserDataIds{get; set;}
public Gss_CsHelathCheckExtension(ApexPages.StandardSetController standardController)
    this.setCon =standardController;
    lstSelUserDataIds = new String[]{};
        for(case selectedRec : (List<case>)setCon.getSelected())



<!-- caselist value from vf page
 <aura:attribute name="caselist" type="String[]"/>

Js side:

var action=component.get("c.getCaseDetails");
action.setCallback(this,function(response) {
   var state=response.getState();

Server side:

public static List<object> getCaseDetails(String [] caseIDStr){
  //for this query id values are not passing.If I do hardcode it will work
        clist=[Select Id, 
CaseNumber,GSS_Business_unit__c,GSS_Support_Level__c,owner.Name from Case 
     where Id IN:caseIDStr];
    system.debug('clist --->'+clist);

    for(Case c: clist ){
        caseSerExcList.add(new CaseAssociatedSerExc(c));

Visualforce's default formatting for a list of strings is in the form:


Which means your code looks like this:

var  myList = '[value1,value2]';

So when you split it, you get an array that looks like this:

var tempmylist = ['[value1','value2]'];

Which is what ultimately gives you that bizarre value in your Lightning Component's controller.

Instead, serialize the list as JSON initially and present that to your script:

public String lstSelUserDataIds{get; set;}


lstSelUserDataIds = JSON.serialize(dataIds);


var myList = {!lstSelUserDataIds}; 
$Lightning.use("c:Gss_CloneSkillsToApp", function(){
        { caselist : myList },
  • Problem is : If I remove quotes myList = {!lstSelUserDataIds} component isnot loading.Value will not pass from vf page to Lightning components. If I add it in quote value will pass from vf page to lightning components Feb 11 '19 at 15:14
  • still that issue is present. If I pass myList values in quotes.still same issue present Feb 11 '19 at 15:35
  • @AnnappaPH You need to json serialize, it should be a Srting instead of Dtring[].
    – sfdcfox
    Feb 11 '19 at 16:27

As I noted in a comment on your previous question, the debug log clearly shows that what is reaching your Apex controller is not a List of Ids. It is a List containing exactly one String, whose value is the literal text '[5001k..., 5001k...]'.

You can demonstrate this for yourself just by running in the Developer Console

System.debug(new List<String>{ '001', '002' });

which yields

23:00:23:004 USER_DEBUG [1]|DEBUG|(001, 002)

Note that there are no square brackets - Apex does not use square brackets when debugging a List.

The code that populates v.caselist in your JavaScript controller is at fault here. I was mistaken, sfdcfox identified the root cause in your Lightning Out code.

The contents of your attribute are not what you think they are, and you need to work through your code to determine why.

  • I am happy to accept u r suggestion..I don't think it will be not the ans for my question..I am cross verifying it.. and I mentioned it in comments my debug results and root causes Feb 11 '19 at 15:42
  • I missed the root cause. sfdcfox found it.
    – David Reed
    Feb 11 '19 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.