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
phyerlightphyerlight 

Problem with report on Opportunities without open tasks or up-coming events

Hi, I have a bit of a problem with a report I'm trying to generate. Perhaps my implementation is to blame.

I need to collect a list of the opportunities that don't have any open tasks on them or events that are still in the future.

My current implementation works by collecting all opportunities, then collecting all open tasks that are attached to opportunities and collecting all events that are attached to opportunities and their end date is after the current date. Then removing each of the associated opportunities from the first list of opportunities leaving the set of opportunities that don't have any open tasks or up-coming events.

The problem I'm running into is that A) lists can only hold 1000 objects and B) queries can only return 10,000 records. The first thing that comes to mind to fix this is to use the LIMIT statement in the queries and then get multiple sets of records using an offset like would normally be available in SQL. But it doesn't seem that that feature is available in SOQL.

So, how would I be able to make multiple queries starting off one where another left off? There doesn't seem to be a queryMore function in apex like there is in the API.

Any help would be appreciated. Of if I'm taking the completely wrong approach to do this, let me know and I'll try to come up with something else.

Thanks, phyerlight