findOrdersByTrackingNumber
function allows you to locate orders associated with a provided tracking number. When executed in the Execute JavaScript block, it checks for the existence of orders in the system and, if found, returns a response array containing full details of the orders associated with the tracking number — including customer information, tracking details, purchased items, and payment status.
payload.tracking
.
findOrdersByTrackingNumber
function and search for the orders associated with the provided tracking number.
payload.orders = await findOrdersByTrackingNumber(payload.tracking)
to search for orders associated with the tracking number provided by the customer. This way, the tracking number saved in the payload.tracking
variable is used by the findOrdersByTrackingNumber
function to retrieve the orders linked to that tracking number. The result is stored in payload.orders
as an array containing the orders.
Example Code
for
and if/else
structures. These commands allow for detailed and conditional formatting of the displayed information. To deepen your understanding of Reportana® Script and explore additional examples, refer to the full documentation: Reportana® Script - Documentation.
findOrdersByTrackingNumber
Function