the code looks like this:
import wixData from ‘wix-data’;
…
export async function Products_beforeInsert(item, context) {
let result = await wixData.query(‘Collections’).find();
let currentCollection = result.items.filter(i => i.name === item.collections);
item.name = item.name;
item.genericName = item.genericName;
item.productImage = item.productImage;
item.description = item.description;
item.currency = item.currency;
// this is the code here
item.InStock = true ;
if (currentCollection.length > 0) {
item.collections = currentCollection[0]._id;
}
return item;
}
after i use import csv. it appears as literal true word in the field, not the usual checked.