Hi Folks!
Hope you’re well. I’ve been facing issues with correctly inserting a reference between my databases. Code is below but some context:
● The aim here is insert a reference into the “member” field of the Portfolios database.
● The item being referenced should be the ID of the current item within the Members Dataset.
● The item for the reference to be placed within should be current item within the Portfolios Dataset, in the “member” field.
Could anyone share some light here? I’ve checked and all fields correctly correspond to their correct attributes etc. Happy to share my site if necessary.
$w.onReady(function () {
$w("#portfoliosData").onReady( () => {
let MembCurrentItem = $w("#membersData").getCurrentItem();
let PortCurrentItem = $w("#portfoliosData").getCurrentItem();
wixData.insertReference("Portfolios", "member", PortCurrentItem._id, MembCurrentItem._id)
.then( () => {
console.log("Reference inserted");
} )
.catch( (error) => {
console.log(error);
} )
}
)
} )
As always, huge thanks in advance!
Phil