As per requirement i was query to external object for selected product in where clause i was put all the product id but till 100 Id its working fine but for 200 its giving error . How we can avoid is their any function that we can use for first 100 at time we can hit and after that 100 we do in asynchronous . And in my requirement maximum product id come at time is 200 not more then this .

Error - 19:20:56:334 XDS_RESPONSE dataSourceType:OData|dataSourceName:One Portal Azure Integration|entity:ONP_GPDCNBirthDeath|offset:-1|limit:2001|select:BirthDate,BirthDateChangedFlag,BirthOutsideWeek12Flag,BrandStandardName,DeathDate,DeathDateChangedFlag,Description,GenericPDCN,Id,LastChangeByUserDatetime,NewlyArrivedFlag,Status,WholesalerNumber,ZeroForecastSumFlag|filter:Id eq 7712L or Id eq 7713L or Id eq 7714L or Id eq 7715L or Id eq 7720L or Id eq 7721L or Id eq 7722L or Id eq 7723L or Id eq 7724L or Id eq 7725L or Id eq 8078L or Id e

  lstPDCNId = (List<Decimal>) JSON.deserialize(acceptRejectPDCNId, List<Decimal>.class);

            lstAcceptRejectPDCNlst = [SELECT Id__c, BirthDate__c, DeathDate__c, GenericPDCN__c, LastChangeByUserDatetime__c, 
                                      BirthDateChangedFlag__c, BirthOutsideWeek12Flag__c, DeathDateChangedFlag__c, 
                                      NewlyArrivedFlag__c, Status__c, WholesalerNumber__c, BrandStandardName__c, Description__c,
                                      FROM ONP_GPDCNBirthDeath__x 
                                      WHERE Id__c IN : lstPDCNId];

1 Answer 1


As mentioned here, there is a limit on the records you can retrieve in a single query. This limit is 2000 records. Your code is trying to retrieve more records. Try using batch apex as mentioned here: https://trailhead.salesforce.com/content/learn/modules/apex_basics_dotnet/async_apex?trailmix_creator_id=strailhead&trailmix_id=prepare-for-your-salesforce-platform-developer-i-credential

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .