This is an extension of this thread, https://www.wix.com/corvid/forum/community-discussion/multi-page-form-why-do-we-think-it-is-not-working? , but this a new issue. I am trying to create a contact so that the triggered email sends to Admin. I am not using a third party because I don’t want plain text emails with the form info. I want a stylized template.
Let me know if this is possible.
URL: https://elizabethjhay.wixsite.com/mysite-9/thankyou
//-------------Imports-------------//
import wixData from'wix-data';
import {session} from'wix-storage';
import wixCrm from'wix-crm';
//-------------Form ID Code-------------//
$w.onReady(function () {$
w('#formIdInput').value = session.getItem("formId");
$w('#formtype').value = session.getItem("title");
$w('#business').value = session.getItem("companyName");
$w('#adminEmail').value === "ehey@metest.com"});
//-------------Notification-------------//
exportfunction Home_click(event) {
wixCrm.createContact({
"firstName": $w('#adminEmail').value,
"emails": [$w("#adminEmail").value] })
.then((contactId) => {
wixCrm.emailContact("RwiGjN4", contactId,
{"variables":
{"formId": $w('#formIdInput').value,
"Form_Type": $w("#formtype").value,
"Business_Name": $w("#business").value, } })
.then(() => {// do something after the email was sent })
.catch((err) => {// handle the error if the email wasn't sent }); });}
I also tried this code:
//-------------Imports-------------//
import wixData from'wix-data';
import {session} from'wix-storage';
import wixCrm from'wix-crm';
//-------------Form ID Code-------------//
$w.onReady(function () {
$w('#formIdInput').value = session.getItem("formId");
$w('#formtype').value = session.getItem("title");
$w('#business').value = session.getItem("companyName");
$w('#adminEmail').value = "ehey@metest.com"});
//-------------Notification-------------//
exportfunction Home_click(event) {
wixCrm.createContact({
"firstName": $w('#adminEmail').value,
"emails": [$w("#adminEmail").value] })
.then((contactId) => {
wixCrm.emailContact("RwiGjN4", contactId,
{"variables":
{"formId": $w('#formIdInput').value,
"Form_Type": $w("#formtype").value,
"Business_Name": $w("#business").value, } })
.then(() => {// do something after the email was sent })
.catch((err) => {// handle the error if the email wasn't sent }); });}