Is it possible to get a customer to fill out a form (questionnaire) and depending on their answers a specific triggered email will be sent to them (showing them the results)?
Thanks Yisrael,
However is it possible for different emails (results) to be sent depending on the answers provided in the form?
Hey Tom,
Sure. In the sendFormData() function you can check on whatever conditions you want and then send the appropriate content (email).
Good luck,
Yisrael
Thanks Yisrael,
I will have a go!
You need to provide the contactId as shown in the code samples in the emailContact() API:
import wixCRM from 'wix-crm';
$w.onReady(function () {
$w("#myButton").onClick(() => {
wixCRM.createContact({
"firstName": $w("#firstName").value,
"lastName": $w("#lastName").value,
"emails": [$w("#email").value],
"phones": [$w("#phone").value]
})
.then((contactId) => {
wixCRM.emailContact("thankyou", contactId, {
"variables": {
"firstName": $w("#firstName").value,
"lastName": $w("#lastName").value
}
});
});
});
});
Hi
I have created a submission form and a triggered email ‘pricePlans’ and put the following code behind the submit button on the form…
import wixLocation from ‘wix-location’;
import wixCRM from ‘wix-crm’;
$w.onReady( function () {
$w(“#button1”).onClick(() => {
wixCRM.createContact({
“firstName”: $w(“#input4”).value,
“lastName”: $w(“#input1”).value,
“emails”: [$w(“#input2”).value],
“phones”: [$w(“#input3”).value]
})
.then((contactId) => {
wixCRM.emailContact(“pricePlans”, contactId)
.then(() => {
// do something after the email was sent
wixLocation.to(‘/pdf-thank-you-page’);
})
. catch ((err) => {
// handle the error if the email wasn’t sent
});
});
});
});
The form submits successfully, we receive email notification that a contact has submitted the form, they see the thank you page on the website, but the triggered email is not sent to the contact.
Any help, advice or pointers would be greatly received.
Many thanks
Darren
I have asked the same thing here: https://www.wix.com/code/home/forum/community-discussion/trigger-email-problem-needed-solving
Hopefully they can get back to us to solve this issue. I think I have set up everything just right but it won’t send out the triggered email…