Issue with code

I created a triggered email called “Feature.” I’ve tried the code with ‘Feature’ and Feature but for some reason it’s not being found in the system and the emails aren’t triggering.

import { triggeredEmails } from ‘wix-crm’;
import wixCRM from ‘wix-crm’;
import { session } from ‘wix-storage’;

$w.onReady(() => {
$w(“#dataset1”).onReady(() => {
$w(“#dataset1”).onAfterSave(() => {

        //TRIGGERED EMAIL 📨 
            "firstName": $w('#input4').value,
            "buisnessName": $w("#input5").value,
            "emails": [$w("#input6").value]

        }).then((contactId) => {

            triggeredEmails.emailContact('Feature', contactId, {
                variables: {
                    firstName: session.getItem("firstName"),
                    businessName: session.getItem("buisnessName"),
                    email: session.getItem("email")


$w("#firstName, #buisnessName, #email").onInput(() => {

    session.setItem("firstName", $w("#input4").value)
    session.setItem("buisnessName", $w("#input5").value)
    session.setItem("email", $w("#input6").value)



Additional information:

Hi! Is there a reason you have an onAfterSave event handler inside your dataset’s onReady event handler? And are you able to ensure that the code inside the onAfterSave is able to run (through console.logs or any other method)?

I would try debugging a bit more. Throw a few console.logs in there, to see exactly where the issue is.

In addition, it looks like you’re using the ‘wix-crm’ API, which is now deprecated (but should still work I think?), and has been split into wix-crm-frontend and wix-crm-backend. You might want to try updating your code to use wix-crm-frontend and the appendOrCreateContact() and emailContact() functions.