Fernando Batres
08/13/2025, 5:03 PMCeligo AI
08/13/2025, 5:03 PMAI generated answer (using internal Slack threads):To limit the number of records returned by a custom search in NetSuite to a maximum of 30, you can use the
runPaged
method of the N/search
module in SuiteScript. This method allows you to specify a page size, which effectively limits the number of records returned by the search.
Here is a sample code snippet:
javascript
var mySearch = search.create({
type: "customrecord_my_custom_record",
filters: myFilters,
columns: myColumns
});
var myPagedData = mySearch.runPaged({pageSize: 30});
myPagedData.pageRanges.forEach(function(pageRange) {
var myPage = myPagedData.fetch({index: pageRange.index});
myPage.data.forEach(function(result) {
// Process each result here
});
});
In this example, the pageSize
parameter in the runPaged
method is set to 30, which means that each page of data returned by the search will contain a maximum of 30 records. The forEach
loop then processes each page of data, and the nested forEach
loop processes each record in the page.
Remember to replace "customrecord_my_custom_record"
, myFilters
, and myColumns
with your actual search type, filters, and columns.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/13/2025, 5:03 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834831119
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827905953
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82745409
Celigo AI
08/13/2025, 5:03 PMFernando Batres
08/13/2025, 5:05 PM