We need to call an asynchronous function on the event 'beforeEventSave'. Depending on the functions response, the event changes should be applied or rejected. According to the documentation we need to set context.async to true and call context.finalize(false) to reject the event the event save.
Here is the code simply using setTimeout()
async beforeEventSave({ eventRecord, source: context }) {
context.async = true;
setTimeout(() => {
context.finalize(false);
}, 5000);
return false;
},
The console returns: "Uncaught TypeError: context.finalize is not a function"
Can you tell me where the error is?
Best regards