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
Abhilash Gupta 21Abhilash Gupta 21 

How to display more than 2000 records from a list view using standard set controller in Lightning?

Hi All,

How to display more than 2000 records from a list view using standard set controller in Lightning component?
The default setPagesize limit is 2000.

Thanks,
Abhilash
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Abhilash,
 
public static final String DESIRED_LISTVIEW_LABEL = 'All';
public SomeClass(ApexPages.StandardSetController controller)
{
    if (!controller.getSelected().isEmpty())
        return [SELECT Name FROM MyObject__c WHERE Id IN :controller.getSelected()];
    for (SelectOption listViewOption : controller.getListViewOptions())
    {
        if (listViewOption.getLabel() == DESIRED_LISTVIEW_LABEL)
        {
            controller.setFilterId(listViewOption.getValue());
            break;
        }
    }
    // do stuff
}

Please refer the below link for reference. I hope it will be helpful.

Please mark it as best answer if the information is informative.

Best Regards
Rahul Kumar