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
Thiago Barbosa 1Thiago Barbosa 1 

ApexPages.StandardSetController in lightning (filterId)

public void refreshOptyList(){
    list<Opportunity> testList = new list<Opportunity>();
    
    optyList.clear();
    tooManyResults = false;
    if (filterId <> null && filterId<> 'None'){
        optySetController.setFilterId(filterId);
        testList = (list<Opportunity>)optySetController.getRecords();
        searchPerformed = true;
    }else searchPerformed = false;
    
    System.debug('Filter used=>'+filterId);
    System.debug('Result #=>'+ optySetController.getResultSize());
    
    Integer counter = 0;
    
    for (Opportunity opty:testList){
        optyList.add(new cOpty(Opty));
        counter++;
        if (counter == 999){
            tooManyResults = true;
            break;
        }
        
    }
    
}
 
public MassReassignOpportunitiesController(){
    //Variable Init
    optyQueryString = 'SELECT name,StageName,Ownerid, Owner.Name, CloseDate from Opportunity where isDeleted=false';
    optyList = new List<cOpty>();
    optySetController = new ApexPages.Standardsetcontroller(Database.getQueryLocator(optyQueryString+' limit 1000'));
    filterId = listviewoptions[0].getValue();
    searchRecord = new Opportunity();
    helperRecord = new Reassign_Helper__c();
    isSuccess = true;
    searchPerformed = false;
    tooManyResults = false;
	isLightning = false;
    mapErros = new Map<String, String>();
    //Apply the default filter
    //refreshOptyList();
}

 
NagendraNagendra (Salesforce Developers) 
Hi Thiago,

Sorry for this issue you are encountering.

May I suggest you please check with below link from the stack exchange community exactly with a similar discussion which should help. Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra