I'm working on making some JavaScript list view buttons "Lightning Ready" and am trying to find a clean way to do that. A recommended approach (somewhat counter-intuitively) is to use a Visualforce page and a controller extension of a StandardSetController. See e.g.:

I have rather a lot of these to deal with and so have asked Is there any way to pass constants from an apex:page so that the controller method invoked via its action attribute can be configured?. But behind that, the real aim is to avoid having to create a large number of separate Visualforce pages. The general solution to that overall problem is to use query string parameters, so that one Visualforce page can handle all the cases. But query string parameters can only be added for a Custom Button that has the "Content Source" option of "URL" and not "Visualforce Page".

Am I correct that for the checked Id values from the list view and the return URL to be passed to the StandardSetController, the "Visualforce Page" option must be used so removing the opportunity of using query string parameters? Seems to be the case so far in my testing...

  • @gNerb Pity. If you are sure just post that as the answer.
    – Keith C
    Aug 30, 2018 at 17:11
  • "yes" is too short for an answer :P I'm trying to think of any alternatives or some other content I can offer
    – gNerb
    Aug 30, 2018 at 17:11
  • Im afraid what @gNerb says is true! I will update you if i find something else Aug 30, 2018 at 17:22
  • Quick question do you have multiple list view actions per object or one per object? Aug 30, 2018 at 17:27
  • Some objects have as many as 5 list view actions so one Visualforce page per object seemed like a reasonable compromise (though one Visualforce page overall would be better still as the "shape" is the same across most of them).
    – Keith C
    Aug 30, 2018 at 17:29

1 Answer 1


Yes you are correct. Maybe you have to create multiple VF pages but you could create a VF component that does the bulk of the work. Create an attribute to that component that is set via the page and pass in the list of sobjects or even just a single VF page controller/extension that you use on all your pages.

  • Looks like I'll end up with many pages, one component and one controller. But that controller will need many methods so it can be configured from the page action attribute, or some hokey checking of the current page name.
    – Keith C
    Aug 30, 2018 at 17:18
  • It's 6 of 1 half dozen of another. Multiple pages/controllers is definitely a pain but one component with a ton of methods and a massive switch statement or what ever is also a huge pain. When you think about your JS buttons are you using 1 source script with a billion methods or do you have all the code you need separated out into each button?
    – gNerb
    Aug 30, 2018 at 17:22
  • The JS buttons are each self-contained and access a per-sobject Apex class for the webservice methods where there can be up to 5 different methods. Just would like to add the minimum of new components so less clutter and less to add to profiles.
    – Keith C
    Aug 30, 2018 at 17:32
  • I don't blame you :P
    – gNerb
    Aug 30, 2018 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .