+ Start a Discussion

Pass the list variable into url. Can I pass It.



      I have plan to pass the list variable into url.


Ex: List<Id> ids = new List<Id>();


Ids have some list of Ids.


public PageReference method(){

       PageReference pr = new PageReference('/VFPage?IdList='+ids);

       return pr;



can I use like this. And Can I use these list variable in VFPage page.





I wouldn't necessarily expect to be able to simply concatenate the ids - it might work, but its reliant on the way that a list is represented as a string.  Usually I iterate the list and add each id in as a named parameter. Something like:


PageReference pr = new PageReference('/VFPage');
Integer idx=0;
for (Id theId : ids)
   pr.getParameters().put('id' + idx, theId);