Not using wix.CRM or wix.Users just an email address that is stored in a database. Basically have a template that I would like to email to people who’s balance is outstanding, the code is below that would be great if someone could let me know if this is possible or whether it’s still a no go…
function fillRepeaterOutstandingBalance() {
var currentDate = new Date();
wixData.query('CourseAvailability')
.gt("outstandingBalance", 0)
.find()
.then((results) => {
if (results.totalCount > 0) {
$w('#outstandingPaymentsRepeater').data = results.items;
$w('#outstandingPaymentsRepeater').onItemReady(($w, itemData, index) => {
$w("#courseTitleText").text = itemData.title;
$w("#customerNameText").text = itemData.fullName;
$w("#totalPriceText").text = "£" + itemData.totalPrice;
$w("#dateText").text = itemData.date.toDateString();
$w("#paymentReceivedText").value = itemData.paymentReceived;
$w("#participantsText").value = itemData.numberOfParticipants;
$w("#customerEmail").text = itemData.customerEmail;
$w("#amountDueText").value = "£" + itemData.outstandingBalance;
$w("#sendReminderButton").onClick((event) => {
let email = itemData.customerEmail;
let name = itemData.fullName;
let courseTitle = itemData.title;
let totalPrice = itemData.totalPrice;
let outstandingBalance = itemData.outstandingBalance;
let paymentDate = itemData.date.toDateString();
wixCRM.emailContact('outstandingBalanceTemplate', email , {
variables: {
"name": name ,
"courseTitle": courseTitle ,
"totalPrice": totalPrice ,
"outstandingBalance": outstandingBalance ,
"paymentDate": paymentDate
}
});
})
})
}
})
}