Please, somebody help me see what I'm dooing wrong in my code (TRIGGERED EMAILS related)

I’ll deeply appreciate any help! Trying to sum it: Basically I have the folowing code in my page, that is for a form-like test for aptitude for use of one of the products in my site, so basically people will submit to the dataset and onSave it will get every answer field in my dataset and save in a variable, then it will fill and send my triggered email form. it is working fine since 2022. Now boss asked me to replicate the same to another product, and so I did, new page, new quesitons,new collection, new dataset, copy and paste the code, changed the “#s” needed and the id from the new triggered email form, all set.
Now that new form refuses to send the e-mail, I tried “console.error, console.error(“Error details:”, err.details); and console.log(“Full error object:”, err);” but all I get is the message:

<“full error object: Bad Request: please check the user inputs.”>

The code I’m working with is:

import { triggeredEmails } from 'wix-crm';

$w.onReady(function () {});

    export function formaG4CollectorDataset_afterSave() {
        let itemObj = $w("#formaG4CollectorDataset").getCurrentItem();

        console.log(itemObj.nome);
        console.log(itemObj.funcao);
        console.log(itemObj.rg);
        console.log(itemObj.cep);
        console.log(itemObj.email);
        console.log(itemObj.cidade);
        console.log(itemObj.estado);
        console.log(itemObj.empresa);
        console.log(itemObj.endereco);
        console.log(itemObj.cresposta1);
        console.log(itemObj.cresposta2);
        console.log(itemObj.cresposta3);
        console.log(itemObj.cresposta4);
        console.log(itemObj.cresposta5);
        console.log(itemObj.cresposta6);
        console.log(itemObj.cresposta7);
        console.log(itemObj.cresposta8);
        console.log(itemObj.cresposta9);
        console.log(itemObj.cresposta10);
        console.log(itemObj.cresposta11);
        console.log(itemObj.cresposta12);
        console.log(itemObj.cresposta13);
        console.log(itemObj.cresposta14);
        console.log(itemObj.cresposta15);
        console.log(itemObj.cresposta16);
        console.log(itemObj.cresposta17);
        console.log(itemObj.cresposta18);
        console.log(itemObj.cresposta19);
        console.log(itemObj.cresposta20);
        console.log(itemObj.cresposta21);
        console.log(itemObj.cresposta22);
        console.log(itemObj.cresposta23);
        console.log(itemObj.cresposta24);
        console.log(itemObj.cresposta25);
        console.log(itemObj.cresposta26);

    const MY_ID = "8f3718a1-8f09-4882-8b9f-72a067661b74";
                triggeredEmails.emailMember('provaFORMA', MY_ID, {

                        variables: {
                            nome: itemObj.nome,
                            funcao: itemObj.funcao,
                            rg: itemObj.rg,
                            email: itemObj.email,
                            cep: itemObj.cep,
                            cidade: itemObj.cidade,
                            estado: itemObj.estado,
                            empresa: itemObj.empresa,                          
                            endereco: itemObj.endereco,
                            cresposta1: itemObj.cresposta1,
                            cresposta2: itemObj.cresposta2,
                            cresposta3: itemObj.cresposta3,
                            cresposta4: itemObj.cresposta4,
                            cresposta5: itemObj.cresposta5,
                            cresposta6: itemObj.cresposta6,
                            cresposta7: itemObj.cresposta7,
                            cresposta8: itemObj.cresposta8,
                            cresposta9: itemObj.cresposta9,
                            cresposta10: itemObj.cresposta10,
                            cresposta11: itemObj.cresposta11,
                            cresposta12: itemObj.cresposta12,
                            cresposta13: itemObj.cresposta13,
                            cresposta14: itemObj.cresposta14,
                            cresposta15: itemObj.cresposta15,
                            cresposta16: itemObj.cresposta16,
                            cresposta17: itemObj.cresposta17,
                            cresposta18: itemObj.cresposta18,
                            cresposta19: itemObj.cresposta19,
                            cresposta20: itemObj.cresposta20,
                            cresposta21: itemObj.cresposta21,
                            cresposta22: itemObj.cresposta22,
                            cresposta23: itemObj.cresposta23,
                            cresposta24: itemObj.cresposta24,
                            cresposta25: itemObj.cresposta25,
                            cresposta26: itemObj.cresposta26,
                            
            }
        })
        .then(() => {
             console.log("E-mail sent!");

    })
    .catch((err) => {
        console.error("Error sending e-mail:", err);

    });
}






Hello, I give you this text that explains how to use triggeredEmails in the frontend of the site.

When you use it in Frontend you can only pass as member ID the one of the connected member getting it from the currentMember function.

As far as I can see you are sending a static ID.

So, in Front that will never work.

You can use for that kind of sending the same function but from backend and call it from front.

if you need help text me to info@lightningteam.co

I don’t really get it. I’m using the ID of the sites owner e-mail ak.a. my email, that I retrieved from the PrivateMembersData Collection of the members area. what frustrates me more is that it works on the other page exactly like that. and it is the same site, all I did was duplicate that exact page, new collection, new dataset, new fields and new triggered mail form. As I said it works on the other page tjust fine. on this one however it keeps saying “Error sending e-mail: Bad Request: please check the user inputs.”. is there a limitaion of how much forms on triggered mails an ID can be associated with?

Ill will read the page you sent and try to understand. thank you

If the error is referencing user inputs then most likely there is a format that is not compatible with what you are trying to save or with what you are trying to send.

Also, why are you using after save? Have you tried before save?

Actually, I don’t know the entire logic flow of how you collect the data that you want to send so before save may not make much of a difference in your case.