Model.debug: Pagination limit reached

  • 1
  • Problem
  • Updated 5 months ago
  • In Progress
  • (Edited)
This is an odd one. I have a snippet that is attempting to query Tasks and Events for eventually export as one file.

Everything seems to be working until the second time the loadmore function is run on TaskExport resulting in 3000 records loaded when there are many more. The model debug property reads "Pagination limit reached" and can't load any more records. Is this a Skuid or Salesforce thing? Is there a suggested workaround?

The last SOQL statement for TaskExport:

"SELECT  --- fields --- FROM Task WHERE (Interaction_Type_Bucket__c in ('Hubspot'))AND(Start_Date__c != null) LIMIT 1001 OFFSET 2000"

Here's the snippet. 
skuid.snippet.register('exportActivities',function(args) {var params = arguments[0],
TaskExport = skuid.$M('TaskExport'), EventExport = skuid.$M('EventExport'), ActivitiesExport = skuid.$M('ActivitiesExport'), rows = [], activityModels = [TaskExport,EventExport], inputfilename = params.$Input.Filename, chartId = params.$Input.chartId, condition, $ = skuid.$; var dfd = $.Deferred(); function loadmore(model){ model.loadNextOffsetPage(function (){ continueLoadingOrNot(model); }); } function continueLoadingOrNot(model){ if(model.canRetrieveMoreRows){ loadmore(model); } else if (!TaskExport.canRetrieveMoreRows && EventExport.canRetrieveMoreRows){ loadmore(EventExport); } else if (!TaskExport.canRetrieveMoreRows && !EventExport.canRetrieveMoreRows){ rows = TaskExport.data.concat(EventExport.data); ActivitiesExport.adoptRows(rows); ActivitiesExport.sortData('StartDate'); ActivitiesExport.exportData({ fileName: inputfilename, doNotAppendRowIdColumn: true, }); $.unblockUI(); dfd.resolve(); } } function failedLoad(){ $.blockUI({ message: 'Something went wrong', timeout: 3000 }); dfd.reject(); } function setCondition(model,conditionName,{value, values}){ condition = model.getConditionByName(conditionName); if (condition.operator == 'in'){ model.setCondition(condition,values); } else { model.setCondition(condition,value); } model.activateCondition(condition); } // deactivate other export conditions $.each(activityModels, function(m,model){ $.each(model.conditions, function(c,condition){ if (condition.name && !condition.name.startsWith("master_") && !condition.name.startsWith("activity_master_")){ model.deactivateCondition(condition); } }); }); // set activites based on specific tab if (chartId == 'sales_all_monthly_by_bucket'){ $.each(activityModels, function(m,model){ setCondition(model,'Interaction_Type_Bucket__c',{values: ['Hubspot']}); }); } $.when(skuid.model.updateData(activityModels)) .done(function(){ // dfd.resolve(); continueLoadingOrNot(TaskExport); }) .fail(function(){ failedLoad(); }); return dfd.promise(); });
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb

Posted 5 months ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Oy!

Seems like there's a limit to pagination of 2,000.

So, that basically means that I can get a max 4000 records so long as the 2000 records doesn't cause an apex heap size error. In my case it does. :/

My workaround is to use the following as a framework in my snippet.

Workaround for offset 2000 limit on SOQL query