I am trying to save a record in the DB Connection I called PetitionsUsers. This is my code:
export function btnCreatePetition_click(event) {
console.log('saving... ' + $w('#dbMembers').getCurrentItem()._id + ' hh');
wixData.query('PetitionsUsers').count().then((number) => {
console.log('inside');
$w('#dbPetitions').setFieldValue('createdBy', $w('#dbMembers').getCurrentItem()._id);
$w('#dbPetitions').save().then(() => {
console.log('saved!');
});
});
}
It is successfully going inside first console.log - saving…
Then again it is successfully going into the second console.log - inside
But it is not on the third one - saved!
So can someone give me a hard why this is happening and what i am doing wrong? I checked and $w('#dbMembers').getCurrentItem()._id
is returning the correct user id.