Question:
I want to find a specific user then send that user/member an email. My query:
$w('#sendCardBtn').onClick((event) => {
wixData.query("ybacmembers")
.find()
.then((results) => {
if(results.items.length > 0) {
for (let i=0; i<results.items.length; i++){
if ( (results.items[i].firstName.toLowerCase().trim() == firstName.toLowerCase().trim()) &&
(results.items[i].middleInitial.toLowerCase().trim() == middleInitial.toLowerCase().trim()) &&
(results.items[i].lastName.toLowerCase().trim() == lastName.toLowerCase().trim()) ) {
sendMembershipCardEmail(results.items[i]);
}
}
} else {
// handle case where no matching items found
}
})
.catch((err) => {
console.log(err);
});
})
I cannot find by email address, since folks who buy memberships might buy three (one for them and two for others), and they user their email address for all three. So, I look for fName, middleInital, lName. I thought I could then use that object to send mail, but I get the error stating:
“[“Contact [id=9828bb80-1ec9-4779-9ccc-82ba2271572d] does not have valid email for site [msid=592638b2-43f7-4e90-9d72-a670aeadf798]”]”
Which ID do I need and why when the query returns a member, does this return data not have the correct ID?
Thank you,
Ed