Thanks Yisrael,
That works, we’re just not quite there yet. I’ve got this chicken and egg thing going on, but I think we are close.
The second part of the script you provided I’ve put in the backend events.js file. I’m using the onRsvpCreated() module to send the guest list to Google Sheets as people respond. The eventId is provide by the onRsvpCreated() trigger, so I kind of need to nest the myGetEventFunction inside that so I can use the eventId but then I can’t get the “title” variable out to use in the rest of the function
import { appendValuesWrapper } from ‘backend/googlesheet-wrapper.jsw’ ;
import { myGetEventFunction } from ‘backend/getEvent.jsw’ ;
export function wixEvents_onRsvpCreated ( event ) {
**const** eventId = event . eventId ;
myGetEventFunction ( eventId ). then ( **function** ( event ) {
console . log ( 'event' , event );
**let** title = event . title ;
console . log ( 'event title' , title );
});
**const** rsvp = event . rsvpForm . inputValues ;
//console.log(rsvp);
**const** bb = rsvp [ 0 ]. value ;
**const** formemail = rsvp [ 1 ]. value ;
**const** formlastName = rsvp [ 2 ]. value ;
**const** formfirstName = rsvp [ 3 ]. value ;
**const** addGuests = "0"
console . log ( title );
//let eventName = eventDetails.title;
// console.log(eventName + “!!!”)
try {
let comment = rsvp [ 4 ]. value ;
let phone = rsvp [ 5 ]. value ;
const values =[ title , formfirstName , formlastName , formemail , phone , addGuests , bb , comment ];
console . log ( values );
const res = appendValuesWrapper ( values );
}
**catch** {
**let** comment = "No Comment"
**let** phone = rsvp [ 4 ]. value ;
**const** values =[ title , formfirstName , formlastName , formemail , phone , addGuests , bb , comment ];
**const** res = appendValuesWrapper ( values );
}
}