I have a reference field in my database for user’s email and I’m trying to connect it with the members database so I can use the user’s data. I connected it form the database but when I try to insert the email value in the referenced field it always shows broken reference.
I’ve read a lot of answers on the forum but nothing seems to work.
I first added the email without any editing then I tried to convert it to a string but neither worked.
let newUser = {
"title": $w('#title').value.trim(),
"image": image,
"host": email.toString() // this is the referenced field
}
wixData.insert("users", newUser)
.then((results) => {
console.log(results)
})
.then(emailData => console.log(emailData))
.catch(err => console.log(err))
// console.log(results)
})
.catch((err) => console.log(err));