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
Prash2Prash2 

How to pass List type parameter from one Visualforce (VF) page to another?

I have two VF pages with two separate controllers. In the first page/controller, I build the list of Ids that I want to pass to the second page/controller.

 

I tried using the URL query string but my list contains hundreds of Ids and the URL gets really long, so some of it gets chopped off when it hits the 2nd page. I also looked into possibility of using "pgRef.getParameters().put('OrgIdsStringList', AccountIds);" but apparently we can only set the string parameters and not the List<Id>.

 

What's the best way to pass the List of data from one VF page to another?

 

Thanks!,

Prash....

 

 

Edwin VijayEdwin Vijay

When there is a very long list of parameters to pass from one page to another, passing it throught the URL or using pgRef.getParameters().put() would not work as any URL has a maximum character length.

 

In your case, i would suggest you use a single controller for both the pages. Then, you need not pass the values between the pages but they would still be available between pages as the underlying controller is the same.

 

Also, can you tell us the scenario you are trying to accomplish. Is there a reason you chose to pass the parameters in the URL?