Hey Dan! Hopefully I can point you down the right track - I followed a similar path for a different function and beforeInsert was not working, I believe you’ll need afterInsert and you can see what I achieved below
Check out my code below for duplicating the _id - you’ll need to update your collection name, then define yours with the concatenated version of your link, your data field (in the let newId = item._id line, where item._id is your concatenation), then your sample text.
import wixData from 'wix-data';
export function memberRegistration_afterInsert(item, context) {
let toUpdate = item
let newID = item._id;
toUpdate.newId = newID;
wixData.update("memberRegistration", toUpdate)
.then( (results) => {
item = results;
} )
.catch( (err) => {
let errorMsg = err;
} );
return item;
}
This will go into your backend data.js. file, as screenshot example shows below:
Hope that helps!
