Been scratching my head on this.
I have the below afterInsert Hook
export function itemsDatabase_afterInsert(item, context) {
let options = {
"suppressAuth": true
};
let key = Math.floor(1000000 + Math.random() * 7000000);
item.defaultId = String(key);
return Promise.resolve(item);
}
Its working fine on the Preview Mode & When I manually insert a new row on the live database but it does not work when I submit a data using the Wix Data API from the Live Site.
Shan