Mayesh Nadesan
01/31/2025, 12:50 PMCeligo AI
01/31/2025, 12:50 PMAI generated answer (using internal Slack threads):To limit the number of output records from a search in SuiteScript, you can use the
runPaged
method along with the pageRanges
property. Here's an example:
javascript
var mySearch = search.create({
type: search.Type.SALES_ORDER,
filters: filters,
columns: columns
});
var pagedData = mySearch.runPaged({pageSize: 1000}); // Set the number of records per page
pagedData.pageRanges.forEach(function(pageRange) {
var myPage = pagedData.fetch({index: pageRange.index});
myPage.data.forEach(function(result) {
// Process each result here
});
});
In this example, the pageSize
parameter in the runPaged
method is used to limit the number of records returned per page. You can adjust this number as needed. The forEach
loop then processes each page of results, and within that, another forEach
loop processes each record in the page.
******
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
01/31/2025, 12:50 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833937228
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826285958
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819116771
Celigo AI
01/31/2025, 12:50 PM