Member's name in triggered email?

I want to use the current users entire name (first & last) as a variable(s) in a triggered email. I have been successful in getting their email address into the triggered email, but not the name. I’ve tried several different approaches, but none of them seem to work (always ends up with errors). According to the ‘Members/PrivateMembersData’ dataset, the field name is ‘name’. I am sending the triggered email from the front end, so that’s where I would like to do it from. There must be a way to do this either from the backend or the front end?

Have you looked at the tutorial for sending a triggered email to members?
https://support.wix.com/en/article/corvid-tutorial-sending-a-triggered-email-to-members

Yup… That example assumes you have a form that enters ‘new’ contact information. I would rather not have a member that’s already logged in repeat their entries. If I could query the members database for the ‘name’ that would work, but when I do that I get errors trying to return Item.name, or Item.firstName.

Here is the code snip that works for their email. Note: I defined "count’, “max”, “today1” & “com” earlier in the code.

// Get user email
    let com = "Any Comments"
        let user = wixUsers.currentUser;
            let userId = user.id;
               user.getEmail()
                 .then( (email) => {
                     $w("#text14").text = email              
 //  Trigger the email if list is finished
        if ((count === max)) {
// Send email to current user
      wixUsers.emailUser('Testemail', wixUsers.currentUser.id, {
            variables: {
            "name": email,
            "date": today1,
            "comments": com
      }

Okay, then look in the Wix Users API and it will show you how to find the name of the user.
https://www.wix.com/corvid/reference/wix-users.User.html

Just change the field key lastName to name from the collection etc.
https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields#name-name

How can I get the current user’s name?
Use the currentUser property to get the current user’s id .
Then query the Members/PrivateMembersData collection for the item with that _id.

wixData.query("Members/PrivateMembersData") \
  .eq("_id", wixUsers.currentUser.id) \
  .find() \
  .then( (results) => { \
    lastName = results.items[0].lastName; \
  } );

Yup…tried that awhile ago too. I get the ‘red diamond’ next to the line saying wixData is not defined?

@terrancehudson
Did you add it to your imports at the top of the page like with importing Wix Users?
https://www.wix.com/corvid/reference/wix-data.html

Yup…perhaps I should provide the entire code tomorrow? Maybe I have a simple error that I’m just not catching.

@givemeawhisky Oh my gosh! I found it! in my import line I had a lowercase ‘d’ instead of “D”!!! Geeezzzz
Thanks!