Can a Visualforce page that uses a standardSetController be redirected to (with a list of records passed in) from anywhere other than a list view button?

  • Are you attempting to redirect in Apex, or JavaScript? – sfdcfox Sep 20 '18 at 20:22
  • Either would fine. I have a Visualforce page where I want the users to be able to select from a list and then redirect to a Visualforce Page (from a managed package) that uses a Standard List Controller – brezotom Sep 20 '18 at 20:27

You can't redirect in Apex, because redirects require PageReference, and PageReference doesn't support having a single query string key with multiple values. However, you can do this in JavaScript by constructing a URL that passes in multiple ids values:


This was mentioned in a post from Skuid that documented the way to do it on this page.


You could go the route of cramming a bunch of Ids into a URL however, browsers have a maximum URL size which could cause problems for you.

Ideally, I'd recommend combining the two VF pages into a single page. That's probably the best bet. Create a wizard-like experience where they take action on a virtual page before the contents are replaced with a second virtual page.

You could flag all of the records before the redirect and then re-query for those flagged records on the destination page.

You could try to pass in a query to the new page via a URL. This is not ideal as it opens a window for SOQL injection. Even if you escape your query before using it a savvy user could edit the query to get to records you may not want them to get to.

This question got me thinking. I have not tried anything crazy like this, but you could try to parse your records into a hidden form and then instead of manually redirecting the user you can submit the form via javascript and post the data to your new page. Then you could try to capture the data using ApexPages.CurrentPage.getParameters(). I have no idea if this works but you can bet that I'll be testing it when i get time and posting my results here.

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.