this code does not work and I cat get my head around how it would know in which row the item should be referenced, I have also tried filling in the fieldkey instead of itemobj._id but to no evail.
Does anyone know how to solve this issue, thank you.
Hi @jarod , I was aware of this. I am not trying to insert anything in the private members database but trying to do the opposite and linking the name to the test database. according to the api this is the way to do that or am I wrong?
Found the solution thaks to you Jarod and with a little help of wix devs.
to make things short, this was the actual code I need.
let itemObj = $w("#dataset2").getCurrentItem();
console.log(itemObj._id)
wixData.insertReference("test", "people", itemObj._id , member._id)
It basically came down to me not understanding the insertReference documentation where I thought you had to first reference the original collection, then the current collection and then both ID’s of the items. But apperantly velo has enough with the ID of the item that you want to refer. This is the original code the wx dev team gave me but this would have just created another item which I didnt want.
The advanced department has reviewed the case and got back to us with the clarifications that you should only use insertReference() when adding items to the reference field. Insert() works with the regular reference fields instead.
Your code would look similar to this (with your own IDs and values, of course):