@givemeawhisky User books service from my site so I have user input. I juwt want to send mail like a bill. User fill the form name, mail, date etc. and I am sending the information which user fill + price of service. And again you copy pasted same syntax to me. I am using exact same code on buttonClick and still getting the error. Forget the database I have no buisness with database. I just want to send the information which user fill on the form to send back to him like a bill.
Here is my “buttonClick” code “again” which is the “same” code you write and “still” getting the error. Pls look at it I may miss something so you can correct me if I am.
export function bookBtn_click(event) {
//Creating contact to send e-mail.
wixCRM.createContact({
"firstName": $w('#nameInput').value,
"emails": [$w("#mailInput").value]
})
.then((contactId) => {
console.log("Sending mail to: "+ contactId);
wixCRM.emailContact("booked_mail", contactId, {
"variables": {
"name": $w('#nameInput').value,
"phone": $w('#numberInput').value,
"email": $w('#mailInput'),
"from": From,
"to": to,
"vehicle": vehicle,
"pax": passengers,
"date": $w('#arrivalDate'),
"time": $w('#arrivalTime'),
"price": price
}
})
.then(() =>{
//success.
console.log("Mail has been send.");
})
.catch((error) => {
console.log("There was an error while sending mail to : " +contactId + ". Error: " + error.message);
});
});
}