Hi, I’ve added a function in events.js to create a record in my own table whenever an Event Rsvp is created. If I create the rsvp from Velo Code it creates a single record as I’d expect but if the rsvp is added via the console TWO records are created.
The only difference I can find between them is the memberId field has a null entry and created field isn’t there at all.
Can anyone shed any light on why this might be happening? I don’t know if it might help but here’s the function out of events.js.
export function wixEvents_onRsvpCreated(rsvp) {
let toSave = {
"rsvpId": rsvp.rsvpId,
"eventId": rsvp.eventId,
"totalGuests": rsvp.guests.length,
"guests": rsvp.guests,
"contactId": rsvp.contactId,
}
wixData.insert("EventStatistics", toSave)
.then( (results) => {
let item = results;
} )
.catch( (err) => {
console.error(err);
} );
}
Your help is appreciated