Skip to content
This repository has been archived by the owner on May 2, 2023. It is now read-only.

Search batch size parameter

hayden-t edited this page Apr 21, 2017 · 3 revisions

(im not the author, this is my understanding from reading the code)

Search results in netsuite are generally limited to a maximum of 1000. To get around this rest_suite runs a while loop repeatedly requesting results and accumulating them until it has them all, unless...

This is where batch size comes in, it lets you specify a number greater than 1000 that the searcher will stop at.

Initially i thought it could be used to specify a page size / result set eg less than 1000, but this does not appear to be possible with nlapiSearchRecord, rather nlapiCreateSearch would be better for than.

Here is the logic code from search.js that handles batch size:

Searcher.prototype.isExecutionDone = function(resultsBlock) {
    if(!resultsBlock) { return true }
    allResultsFound = resultsBlock.length != 1000;
    batchSizeMet    = this.results.length >= this.batchSize;
    return allResultsFound || batchSizeMet;
 }
Clone this wiki locally