Hi all, I'm writing a RESTlet that executes a sear...
# suitescript
h
Hi all, I'm writing a RESTlet that executes a search of invoices and then retrieve those invoices' header fields and line items fields as json. However, it keeps running into error "SSS_USAGE_LIMIT_EXCEEDED". What is another approach to get the data? Thanks so much.
b
implement paging
or use your points more efficiently
h
@battk i'm already implementing paging. But it's still taking too long 😞
b
smaller pages
keep in mind i meant Pagination not Search.runPaged
h
Copy code
function searchForEachResult(mySearch, callback) {
         var pagedData;
         var page;
         pagedData = mySearch.runPaged({
             pageSize: 1000
         });
         pagedData.pageRanges.forEach(function (pageRange) {
             page = pagedData.fetch({
                 index: pageRange.index
             });
             page.data.forEach(function (result) {
                 callback(result);
             });
         });
     };
@battk ^^ not something like this?
b
pagination would be returning 1 page at a time from your restlet
and implementing a mechanism for the request to specify which page it wants returned
h
do you happen to have an example? I haven't tried it before
b
as in you needed help returning one page at a time?
or implementing a parameter for which page to return?
h
i'd like help returning one page at a time please
b
make
searchForEachResult
use fetch once
dont loop through the pagedData.pageRanges array
h
Thanks