findOrdersByNumber
function allows locating a specific order by its order number. When executed in the Execute JavaScript block, it checks for the existence of the order based on the order number provided by the customer and, if found, returns as a response an array with complete details about the order in question.
payload.number
.
findOrdersByNumber
function and search for the order associated with the provided order number.
payload.orders = await findOrdersByNumber(payload.number)
to search for the order associated with the number provided by the customer. In this way, the order number saved in the payload.number
variable is used by the findOrdersByNumber
function to retrieve the order linked to that number. The result is stored in payload.orders
as an array containing the corresponding order.
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.
findOrdersByNumber
Function