Hi everyone,
I have a common issue with the insert of reference fields into a collection. I get always the error “reference is broken”.
Unfortunately there are many unsolved posts concerning this topic in the forum and I wonder if there is no one out there who knows the answers?
With one answer you are able to make many people happy
https://www.wix.com/corvid/forum/community-discussion/reference-is-broken-2
https://www.wix.com/corvid/forum/community-discussion/reference-field-broken
https://www.wix.com/corvid/forum/community-discussion/reference-is-broken-3
https://www.wix.com/corvid/forum/community-discussion/reference-field-1
https://www.wix.com/corvid/forum/community-discussion/reference-is-broken-1
I have two collections
1: GuestPhotos
photoid, photo, year, month_id, motif_id, uploadedby, description
2: Month
month_id, landuage_id, month_d, month_f
Now I’d like to insert a record with a new photo to the GuestPhotos collection.
Without referenced fields I make that this way:
let dataRecord = {
photoid : newPhotoId,
uploadedby : userName,
year : Number($w('#ddYear').value),
month_id : $w('#ddMonth').value,
motif_id : $w('#ddMotif').value,
description : $w('#tbDescription').value,
photo : imageUrl
};
// Speichern des Datensatzes in der Collection
const insertResults = await wixData.insert("GuestPhotos", dataRecord)
}
I’ve already studied the wixdata.insertReference() method, but I can’t find the right way to use it.