Hello,
I need to include multiple rows from a custom dataset in a triggered email.
I have have successfully sent the triggered email, however, it only sends one row of the datasets order. This time it was the 95th out of 101 line items.
Is there a way to iterate through the dataset and include all of the line items for that order in one email?
try {
let ctr = 1;
wixData.query("customerLicenses").eq("paidOrderId", orderNumber).find().then((result)=>{
if (result.items.length > 0) {
let nbrRecs = result.totalCount
let lineItem = result.items[0]
triggeredEmails.emailContact(triggeredEmailTemplate, contactId, {
variables: {
firstName: ""+lineItem.firstName+"",
lineNbr: ctr,
license: ""+lineItem.prodLicense+"",
prodName: ""+lineItem.prodName+""
}
});
ctr++;
}
})
console.log('Email sent to contact');
console.log(emailToFind + " " + orderNumber + " " + ctr)
} catch (error) {
console.error(error);
}
Thank you