// this next bit of code gets the Wix Member (not the BD Member) ID value
// this ID is used to set the destination for a triggered email thru the
// Wix API. The ID value is not accessable through the Content Manager nor
// the Wix Dashboard, hence this work-around.
let curUserEmail = "";
const rtnMember = await currentMember.getMember()
.then((member) => {
id = member._id;
const fullName = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`;
curUserEmail = member.loginEmail;
return member;
})
.catch((error) => {
console.error(error);
});
console.log("id = " + id);
let toInsert = {
"curUserEmail": curUserEmail,
"curUserString": id
}
wixData.insert("ScratchPad", toInsert);