Triggered email to member not working

Hi everyone

I have a form on a dynamic page wich sends out a triggered email to the owner of the dynamic page (The owner of that data row).
But it’s not working…
I tried everything. I haven’t found any article online that could help me.

here’s my 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 user = '_owner';

    $w("#dataset1").onAfterSave( () => {
 
wixUsers.emailUser('S6gaIKl', user, {

  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
        } );

 
    });

});

});

I hope you can help me.

Thanks in advance.

Could you maybe past the console output? Is the userId really “_owner”?

You’re right that’s not right. The console gives me the following:

Wix code SDK error: The userId parameter that is passed to the emailUser method cannot be set to the value _owner. It must be of type uuid.

Kapperszaken Maak Afspraak (Title)
Line 15

Parameters validation has failed.

But how can i get the user id? Or what will i have to use instead of _owner?

You can always get the current logged in user by writing the following (just remove the spaces between currentUser and the dots. Wix thinks the code bellow is a link)


const userId = wixUsers . currentUser . id;

Thanks! But I’d need the owner of the dynamic page or database item. Not the current user. Any Idea how to do this?