Database- Find user email id from owner id in submitted item

Hi Jeff,

Here’s what I got to work.

if you have a private members collection present in your site like this:

You can easily use the following code:

wixData.query(“Members/PrivateMembersData”)
.eq(“_id”,user)
.find()
.then( (results) => {

if (results.items.length > 0)
{
let details = results.items[0];
data.name=details.name;
data.email=details.loginEmail;
data.phone=details.mainPhone;
}

else
{
}

} ) 
. catch ( (err) => { 

let errorMsg = err;
} );

However, you need to create a web module in the Backend section and write this code inside a function there. Because from front-end code won’t have permissions to access this database.
Also, if you don’t have that PrivateMembersData collection, you can easily add it by adding the E-commerce app to your site, and then deleting that E-commerce app if you don’t need it. I think that should work.
Cheers,
Sameer

P.S. Sorry about the late reply