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
Jonathan AlmqvistJonathan Almqvist 

StandardSetController.getSelected returns undefined

<apex:page standardController="Account" extensions="AddCampaignControllerExtension" recordSetVar="Accounts">
    <apex:includeLightning />
    <div id="lightning" style="height:150px;"/>
public with sharing class AddCampaignControllerExtension{
	public List<Account> selectedList{ get; set; }    
    ApexPages.StandardSetController setCon;

    public AddCampaignControllerExtension(ApexPages.StandardSetController controller)
    {
        setCon = controller;
        List<Account> selectedList = setCon.getSelected();

I have these code bits. I have posted only the relevant bits. I am using a visualforce page with a standardcontroller and also an extensioncontroller (standardSetcontroller). My problem is that getSelected is not filling out the selected values from my list view.

Anyone have any help or pointers I would be very glad. Thanks in advance!

Pavit SiddhuPavit Siddhu
https://success.salesforce.com/issues_view?id=a1p300000008XLSAA2
Maybe it Helps
 
Raj VakatiRaj Vakati
When using relationship field in Visualforce page with StandardSetController, StandardSetController.getSelected() does not return expected records in Lightning Experience. 


StandardSetController.getSelected() should return all selected records. 


https://success.salesforce.com/issues_view?id=a1p3A000000mD1GQAU&title=standardsetcontroller-getselected-does-not-return-expected-records-in-lightning-experience


 
public class opportunityList2Con {
    // ApexPages.StandardSetController must be instantiated
    // for standard list controllers
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT Name, CloseDate FROM Opportunity]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
    public List<Opportunity> getOpportunities() {
        return (List<Opportunity>) setCon.getRecords();
    }
}

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_pages_standardsetcontroller.htm
http://salesforcevenkat81215.blogspot.com/2017/06/how-to-show-10000-records-in.html
https://andyinthecloud.com/2013/07/16/how-to-call-apex-code-from-a-custom-button/
http://www.cloudyabhi.com/2013/09/concept-of-standardsetcontroller-for.html
Jonathan AlmqvistJonathan Almqvist

I will read this of course but my problem is slightly different. I NEED to have StandardController="Account" in my visualforce because my visualforce is displaying because I am pressing a List Button on the Account List View.

  So my SetController needs to be an extension, maybe. That is my problem.