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
micwamicwa 

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.
SuperfellSuperfell
The regular API has excellent support for large queries and detecting time based changes (getUpdated), why do you need to rebuild this in apex ?
micwamicwa

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.

ex.

Code:
global class MyQueryMore(){

global String myString = 'test';

}

webservice static MyQueryMore getObjects(String myFilter){

}


 

SuperfellSuperfell
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.
micwamicwa
It works, thanks a lot.