[SalesForce] Searching for records in list view when more than 2000 rows

I have a custom object that has more than 2000 records. I have a custom field, id__c, that is a number that is searchable. The records I have in there have id__c's ranging from 1 to 3000.

I am running into an issue with the default List that is created on the objects tab when you create a custom Object.

If I have the object's list sorted by id__c ascending, and search for 2000 the correct record appears, but if I search for 2001 it does not appear and I get No Results.

If I have the object's list sorted by id__c descending, and search for 2001 the correct record appears, but if I search for 999 is doesn't appear.

I can only assume that this has something to do with SF's 2000 limit restriction on OFFSET in SOQL and that they pre-load the first 2000 records and search through those results rather than actually search for all users?

EDIT:

As requested, here are some pictures of what I mean. For these pictures, I have sorted the list by 'Student Name'.

In this picture, you will see that when sorted by Name, the 2000th record is AGFEYTPtest854:

2000th record

In the next picture, I have reloaded the page and sorted by Name, and searched for AGFEYTPtest854 and you will see there is a search result:

AGFEYTPtest854

In this third picture, I searched for AGFEYTPtest855 and there is no results:

AGFEYTPtest855

And just to confirm that this record does in fact exist, here is my search result when I have the list sorted by a different field:

AGFEYTPtest855 - 2

So as you can see, I don't do the SOQL query. Why does this search bar only search for the first 2000 records depending on the current sort? Shouldn't a search on a particular list, you know, search the whole list?

Best Answer

max 2000 record per 1 query on listview is a standard limitation. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_listviewresults.htm?search_text=list%20view

Lightning does not come out of the box with pagination on list views. However, in classic, with the enhanced UI, you can get pagination on list views. - Because it's implementing offseting on listview queries.

However, you can accomodate custom page on object tab which will include a lightning component work together with offsets and listviews somehow. For example, the dreamhouse example app has a paginator component written in LWC. https://github.com/dreamhouseapp/dreamhouse-lwc/tree/c7a6f90f55080524123fef25a293ded773b36b23/force-app/main/default/lwc/paginator

By checking it's references you can get a picture how you can accomplish it, if you want to.

Check out this discussions within this topic: https://success.salesforce.com/answers?id=9063A000000iS6cQAE https://success.salesforce.com/ideaView?id=0873A0000003bruQAA

Related Topic