Thank you kindly. : -)
I believe I may be getting this error because I need to wrap some of my code in:
$w ( "#webinar-registrants" ). onAfterSave (() => {.....});
OVERVIEW OF PROCESS
- onSubmit - store data to collection // no errors
- buttOnClick executes : (code below)
• Fn call: use SendGrid to send an email // no errors
• Fn call: send ANOTHER email using wixcrm.emailContact() // Failed to fetch
• advance to next slide // no errors
If I need to add the .onAfterSave call, I am not sure where to put it.
However, if this is the cause, I am thinking it would have failed when I try to execute the sendGrid function call
Link to editor page code is below. Here’s the code in question…
export function buttNext3_click(event) {
// Add your code for this event here:
sendFormData(); // send email to admin via SendGrid
sendEmailNotice(); // send email to admin via wix triggered em
$w("#slideshow1").next();
}
function sendEmailNotice() {
let contactId = "a7f3e00a-8d04-49c7-9873-a75d40d2efb1"
let emailId = "SAhxzJf"
console.log("CONTACT ID=");
console.log(contactId);
console.log("EMAIL ID=");
console.log(emailId);
wixCrm.emailContact("emailID", contactId, {
"variables": {
tCompany: $w("#tCompany").value,
tJobTitle: $w("#tTitle").value,
tToEmail: "n/a",
tEM: $w("#tEmail").value,
tFN: $w("#tFirst").value,
tLN: $w("#tLast").value,
tQuestions: $w("#tQuestions").value,
ddDate: $w("#ddDate").value,
tLeadSource: $w("#tSource").value,
tWebinarTitle: $w("#hWebinarTitle").value
}
} )
.then( () => {
console.log("RESULT");
console.log("Triggered email sent");
} )
.catch( (err) => {
console.log("ERROR=");
console.log(err);
} );
}
Any thoughts?
P.S. This is a 2-pg form in a slideshow in a lightbox. here’s the page: