Skip to content

Use of OrderMgr.searchOrders() limits the result set to 1000 orders #5

Description

@clstopher

The historical purchase and purchase item exports as well as the delta purchase and purchase item exports all use the OrderMgr.searchOrders() function to retrieve orders from SFCC:

if(empty(lastRunDate)){
ordersToProcess = OrderMgr.searchOrders(orderStatusForExport.join(' OR '), 'creationDate asc');
}else{
ordersToProcess = OrderMgr.searchOrders(orderStatusForExport.join(' OR ') + ' AND creationDate >= {0}', 'creationDate asc', lastRunDate);
}

But this function is documented to only retrieve up to 1000 orders:

https://salesforcecommercecloud.github.io/b2c-dev-doc/docs/current/scriptapi/html/index.html?target=class_dw_order_OrderMgr.html#dw_order_OrderMgr_searchOrders_String_String_Object_DetailAnchor

  • the result is limited to a maximum of 1000 orders

This will certainly cause a problem for the historical data load, and also may cause a problem for delta loads when order volume is high.

ADDITIONALLY - We've discovered with our production deployment that this function doesn't always work - With 11 million orders on our PROD instance to export, the function returns almost immediately with a timeout exception.

Recommend using OrderMgr.processOrders() instead - It won't work for a chunked job so you can't see progress or how many orders are being sent from the BM UI, but it should at least resolve both of the issues mentioned above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions