Eric Schultz
02/16/2026, 3:10 PMCeligo AI
02/16/2026, 3:10 PMAI generated answer (using internal Slack threads):To run a N/query as paged data and process paged data as mapped results, you can use the
runPaged method of the N/query module. This method returns a PagedData object, which you can iterate over to fetch each page of results. Each page of results is a ResultSet object, which you can then convert to a mapped result using the asMappedResults method.
Here is a sample code snippet that demonstrates this:
javascript
function getAllQueryResults(rootQuery) {
var pagedData = rootQuery.runPaged({ pageSize : 1000 });
var queryData = [];
for (var i = 0; i < pagedData.pageRanges.length; i++) {
var currentPage = pagedData.fetch({ index : i });
var currentPagedData = currentPage.data;
var results = currentPagedData.results;
for (var j = 0; j < results.length; j++) {
queryData.push(results[j].asMap());
}
}
return queryData;
}
In this example, rootQuery is the query you want to run. The pageSize parameter in the runPaged method determines the number of results per page. The fetch method is used to retrieve a specific page of results. The asMap method is used to convert each result into a JavaScript object.
Please note that the maximum page size is 1000, so you cannot pull more than 1000 results at a time. If you have more than 1000 results, you will need to fetch and process each page of results separately.
******
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
02/16/2026, 3:10 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840698302
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83227545
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83013922
Celigo AI
02/16/2026, 3:10 PM