Hello
I am trying to send a triggered email after a custom form on a dynamic page is submitted. The email should be sent to the email in the database item of that dynamic page. I tried to code this, but it doesn’t work. Here’s the code:
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixCrm from 'wix-crm';
import wixWindow from 'wix-window';
$w.onReady(function () {
$w("#dynamicDataset").onReady(() => {
let email = 'email';
$w("#dataset1").onAfterSave( () => {
if(wixUsers.currentUser.loggedIn) {
const userId = wixUsers.currentUser.id;
wixUsers.emailUser('S6gaIKl', email, {
variables: {
fullName: $w("#input4").value,
uur: $w("#timePicker1").value,
klantemail: $w("#input5").value,
date: $w("#datePicker1").value,
info: $w("#textBox2").value,
naamZaak: $w("#input6").value,
}})
.then( () => {
wixWindow.openLightbox("bedankt");
} )
.catch( (err) => {
console.log(err)
$w("#text98").show
} );
}
});
});
});
can anyone help me?
Thanks in advance.
Leon Missoul