+ Start a Discussion

Webservice, return more than 1000 records

We try to implement a werbservice in Apex that will be accessed by another system.
We would like to return custom objects that were modified in a certain timeperiod. The problem is what do we do if there are more than 1000 records?

We can't return a list beause list can only have the maximum size of 1000 records. Any idea what we could return? Is there something similar to a queryiterator that we can return?

Thanks for your help.
The regular API has excellent support for large queries and detecting time based changes (getUpdated), why do you need to rebuild this in apex ?

Because our customer would like to consume a webservice instead of build a query an use the native API.

We found a solution with a custom object that looks similar to the QueryResult (lastindex, array of max 1000 records). But is it possible to return an instance of a class (self implemented class in Apex) in a webservice? When we try it we always get an empty result tag in the SOAP response message.


global class MyQueryMore(){

global String myString = 'test';


webservice static MyQueryMore getObjects(String myFilter){



But the native API is a web service.

to return a instance of a class, the members you want included in the web service need to be marked with the webservice keyword.
It works, thanks a lot.