0

When I use searchOrders() there is a limit of 1,000 orders, but I need to retrieve all orders. So, I tried using queryOrders() even though I knew it will deprecate soon. But the fact is that the results for both methods are different, even using the same query and arguments. Any tips on why?

    var query = 'custom.activeReturnCase = {0}';
    var sort = 'creationDate desc';
    var search = OrderMgr.searchOrders(query, sort, true);  => 8 orders
    var query = OrderMgr.queryOrders(query, sort, true);    => 28 orders

Question 1: Why these different results?

Question 2: Is there any inherent way to paginate using searchOrders()?

1 Answer 1

0

We can use SystemObjectMgr -> querySystemObjects function.

This method has no limit on the number of records.

var SystemObjectMgr = require('dw/object/SystemObjectMgr');
var query = 'custom.activeReturnCase = {0}';
var sort = 'creationDate desc';
var querySystem = SystemObjectMgr.querySystemObjects('Order', query, sort, true);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .