dw.customer
Class OrderHistory
Object
dw.customer.OrderHistory
The class provides access to past orders of the customer.

Note: This class allows access to sensitive financial and cardholder data. Pay special attention to PCI DSS v3. requirements 1, 3, 7, and 9. It also allows access to sensitive personal and private information. Pay attention to appropriate legal and regulatory requirements related to this data. Note: The following methods do not work with Salesforce Order Management orders.

Properties
orderCount  :  Number  (Read Only)
The number of orders the customer has placed in the store.

If the customer is anonymous, this method always returns zero. If an active data record is available for this customer, the orders count is retrieved from that record, otherwise a real-time query is used to get the count.

orders  :  SeekableIterator  (Read Only)
Retrieves the order history for the customer in the current storefront site.

If the result exceeds 1000 orders, only the first 1000 orders are retrieved. Same as

 orderHistory.getOrders( null, "creationDate DESC" )
 

It is strongly recommended to call SeekableIterator.close() on the returned SeekableIterator if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.

Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getOrderCount() : Number
Returns the number of orders the customer has placed in the store.
getOrders() : SeekableIterator
Retrieves the order history for the customer in the current storefront site.
getOrders(query : String, sortString : String, params : Object...) : SeekableIterator
Retrieves the order history for the customer in the current storefront site.
Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.

Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβ€”passing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβ€”this is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?

This isn't just another prep courseβ€”it's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.

The Salesforce B2C Commerce Architect certification is a whole different gameβ€”complex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Method Detail
getOrderCount
getOrderCount() : Number
Returns the number of orders the customer has placed in the store.

If the customer is anonymous, this method always returns zero. If an active data record is available for this customer, the orders count is retrieved from that record, otherwise a real-time query is used to get the count.

Returns:
the number of orders the customer has placed in the store.

getOrders
getOrders() : SeekableIterator
Retrieves the order history for the customer in the current storefront site.

If the result exceeds 1000 orders, only the first 1000 orders are retrieved. Same as

 orderHistory.getOrders( null, "creationDate DESC" )
 

It is strongly recommended to call SeekableIterator.close() on the returned SeekableIterator if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.

Returns:
the orders

getOrders
getOrders(query : String, sortString : String, params : Object...) : SeekableIterator
Retrieves the order history for the customer in the current storefront site.

If the result exceeds 1000 orders, only the first 1000 orders are retrieved. Optionally, you can retrieve a subset of the orders by specifying a query. At maximum 3 expressions are allowed to be specified and no custom attribute expressions are allowed.

It is strongly recommended to call SeekableIterator.close() on the returned SeekableIterator if not all of its elements are being retrieved. This will ensure the proper cleanup of system resources.

Example:
            var orderHistory : dw.customer.OrderHistory = customer.getOrderHistory();
            var orders = orderHistory.getOrders("status = {0}", "creationDate DESC", dw.order.Order.ORDER_STATUS_NEW);
            for each (var order : dw.order.Order in orders) {
                // ... process orders
            }
            orders.close();
 
Parameters:
query - optional query
sortString - optional sort string
params - optional parameters for the query
Returns:
the orders

β™₯
Notifications pending to read