Save field from dataset to another dataset

Hi #givemeawhisky , sorry, I thought you worked for wix and not that it was volunteering. Then thank you even more for all the support.

Unfortunately I’m trying in every way, but it doesn’t work. If I use the same code for a standard field, It’s write the data, but if I use it for a reference field it always gives me the phrase “reference is broken”
Do you know how to fix the problem?

this is my code

let code = $w(“#DDTS1”).getCurrentItem().ContestCode
let toInsert = {
“CodeContest”: code,
};
wixData.insert(“SubscriptionContest”, toInsert)
.then((results) => {
let item = results;
})
. catch ((err) => {
let errorMsg = err;
});