findOrdersByEmail
function allows you to locate orders associated with a customer by using the provided email address. When executed within the Execute JavaScript block, it checks for the existence of orders in the system and, if found, returns an array containing detailed information about the orders linked to that email — including customer details, purchased items, and payment status.
payload.email
.
findOrdersByEmail
function and search for orders associated with the provided email address.
payload.orders = await findOrdersByEmail(payload.email)
to retrieve orders associated with the email provided by the client. This way, the email saved in the payload.email
variable is used by the findOrdersByEmail
function to query the system, and the result is stored in payload.orders
as an array containing the orders.
Example Code
for
and if/else
structures. These commands enable detailed and conditional formatting of the displayed information. To deepen your knowledge about Reportana® Script and explore more examples, please consult the complete documentation: Reportana® Script - Documentation.
findOrdersByEmail
Function