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
VenkataRajaVenkataRaja 

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

Hi,

 

      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.

 

Regards

Venkat

bob_buzzardbob_buzzard

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);
   idx++;
}