How to work around the Salesforce 2k item limit
[Deprecated] - Please use the new pagination feature Salesforce Pagination
The maximum number of rows returned by any SOQL over the REST API is 2.000 per request. In case your data source has more than 2k items the data will be cut off.
You can work around this limitation to request up to 6.000 items with the following workaround.
Merge multiple data sources
Let say you have a data source called Salesforce Accounts
with the following query URL:
https://xxx.salesforce.com/services/data/v45.0/query/?q=Select name from account
Now let’s create a duplicate of this data source and name it Salesforce Accounts - Page 2
and use the following query URL:
https://xxx.salesforce.com/services/data/v45.0/query/?q=Select name from account Offset 2001
By adding Offset 2001
you tell salesforce to return items starting at item no. 2001.
We end up having 2 data sources one for page 1 and another for the second page.
Now creating a new third data source with the Type
- Merge Data Sources
and name it something like Salesforce Accounts - Merged
In the field Datasources to merge
select the two previously created data sources. This should look like this:
This is the final step. Now you can use the merged data source in any field configuration. You may even extend this by adding a third page, but this approach doesn’t scale well and Salesforce only allows up to 5 connections like this in the first place.