Sending values between datasets

I have a dynamic page which displays some content from a dynamic dataset, and includes some user inputs which sends to a another dataset.

How can I pull the content displayed from the dynamic dataset (for example, a product SKU) and send it to the other dataset?

Basically, when someone purchases a product and fills in the form, how can I know what product they purchased?

Hello.

You can use getCurrentItem() function of the dataset to return the item object, then use insert to add the information to another dataset.

Good luck!

Thanks, is there a tutorial to show how to use this?

I have a hidden text field on my page which refers to the field in the first dataset. How do I send this text only to the same name field in the Contact database. At the moment the code I have is below, but doesnt do anything.

import wixData from ‘wix-data’ ;

export function verify_onClick(event, $w) {
let toInsert = $w( “#dynamicDataset” ).getCurrentItem();
wixData.insert( “Contact” , toInsert)
.then( (results) => {
console.log( “done adding item” )
} )
. catch ( (err) => {
let errorMsg = err;
} );
}