Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Paging with the Apex Connector Framework
With server-driven paging, the external system controls the paging and ignores any batch boundaries or page sizes that are specified in queries. To enable server-driven paging, declare the QUERY_PAGINATION_SERVER_DRIVEN capability in your DataSource.Provider class. Also, your Apex code must generate a query token and use it to determine and fetch the next batch of results.
With client-driven paging, you use LIMIT and OFFSET clauses to page through result sets. Factor in the offset and maxResults properties in the DataSource.QueryContext to determine which rows to return. For example, suppose that the result set has 20 rows with numeric ExternalID values from 1 to 20. If we ask for an offset of 5 and maxResults of 5, we expect to get the rows with IDs 6–10. We recommend that you do all filtering in the external system, outside of Apex, using methods that the external system supports.