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
Vivek ViswanathVivek Viswanath 

Apex Trigger how to implement Query more?

Hi All,

 

This is the scenario we are working with and are having an issue looking for a solution.

I am trying to retrieve more than 1000 records in an Apex Query and apparently 1000 is the upper limit to the number of records that can be retrieved.

Dose any one know of a query more in a trigger or how to implement this. 

Below is the query:

for (Lease_Com__c[] leaseCommission :

[select Id, lease_nbr__r.Name, gcp_amt__c, lease_nbr__r.End_User__c, lease_nbr__r.Funded_Dt__c from lease_com__c

where OwnerId = :UserID

and lease_nbr__r.Funded_Dt__c < :dtBeginningOfNextMonth

and lease_nbr__r.Funded_Dt__c >= :dtBeginningOf6MonthsPrevious

order by lease_nbr__r.Funded_Dt__c desc] ) {

}


Vivek Viswanathan


sfdcfoxsfdcfox
That's a governor limit, so queryMore won't help you. Take a look at the docs on triggers and governor limits.
Vivek ViswanathVivek Viswanath
Is there anyway I can implement something like this ( if not a direct query more ). 
 
 
 
Regards
 
Vivek Viswanathan
VikasVikas
Hi Vivek,

Did you have any success?

Please let me know, we are stuck in a similar problem.

Thanks in advance.

/Vikas Arora.
Vivek ViswanathVivek Viswanath
No the govenor limits are an issue however we found another way to do this through an s-control and Apex webservice working together we did implement this. You could embed the s-control in your webpage so that it fires on the refresh of the page.There are other tricks you can use too by keeping tracks of all ids that you have already processed in a hidden Text Area that you right back to and keep a flag on the record that sees if processing is complete processing is complete when your query dosent return anything and so you can limit all your queries to a certain set size (We havent implemented this but in theory you may be able to do it).

Regards

Vivek Viswanathan


Message Edited by Vivek Viswanath on 08-01-2008 05:31 AM

Message Edited by Vivek Viswanath on 08-01-2008 05:31 AM

Message Edited by Vivek Viswanath on 08-01-2008 05:34 AM