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
gtindugtindu 

retrieve id limit reached

This just started happening in the last week (ironically since our instance was upgraded to Summer 10)

 

The following code (which worked before) is now failing miserably - and i cannot even catch the exception to degrade gracefully

 

		List<Period> fys = new List<Period>([Select p.Type, p.StartDate, p.Number, p.Id, p.EndDate From Period p where StartDate <= :date.today() and EndDate >= :date.today()]);
		for(Period f : fys)
		{
			if (f.Type == 'Year')
				this.fiscalYear = f.Number;
			else if (f.Type == 'Quarter')
				this.fiscalQuarter = f.Number;
			else if (f.Type == 'Month')
				this.fiscalMonth = f.Number;				
			else if (f.Type == 'Week')
				this.fiscalWeek = f.Number;

		}

Integer rowLimit = Limits.getLimitQueryRows() == 500 ? 10 : (Limits.getLimitQueryRows() - Limits.getQueryRows());

List<Opportunity> opportunities = new List<Opportunity>([SELECT id, name, account.name, owner.userrole.name FROM Opportunity Where Close_Fiscal_Month__c =: this.fiscalMonth AND Close_Fiscal_Year__c =: this.fiscalYear ORDER BY ForecastCategory LIMIT :rowLimit])

 The error occurs in instantiating the List from the SOQL query... which has always worked FLAWLESSLY for us before... 

 

I could understand the error with maybe some notification... or if there wasn't a way to work around it 

 

List<Opportunity> opportunities = new List<Opportunity>();

for (Opportunity o : [SELECT id, name, account.name, owner.userrole.name FROM Opportunity Where Close_Fiscal_Month__c =: this.fiscalMonth AND Close_Fiscal_Year__c =: this.fiscalYear ORDER BY ForecastCategory LIMIT :rowLimit])
  opportunities.add(o);

 

The workaround is PAAAAINFULLY slow - and has to have a far greater performance impact on the server than the original.  Is this a permanent change... if so - yikes.

 

 

ScoobieScoobie

Instead of what you have:

List<Period> fys = new List<Period>([Select p.Type, p.StartDate, p.Number, p.Id, p.EndDate From Period p where StartDate <= :date.today() and EndDate >= :date.today()]);

 

Have you considered simplifying it to simply:

 

List<Period> fys = [Select p.Type, p.StartDate, p.Number, p.Id, p.EndDate From Period p where StartDate <= :Date.today() and EndDate >= :Date.today()]

gtindugtindu

Semantics - and doesn't impact the error of "retrieve id limit reached"

DCMtechDCMtech

Did you ever get this answered?  I am trying to customize an app and it is giving me the same error.