sendBeacon functionality

I have a form that is required to update other lists after save. I send out a couple of PnP API calls in the spSaved event. This works well most of the time but I've noticed a few users navigate quickly after saving and the API calls don't have time to finish.
I can't use the spBeforeSave event because I need to include the Id of the new list item in my API call for trace-ability.

Is there any way to implement a sendBeacon functionality for those calls from the javascript call? Or am I going the wrong track?

Hello @Arnaud,

You can use MS Flow instead of PnP to update items in other lists when a new item is created.

In your case, it is more suitable as user actions will not affect the process of items update.

Yes I am looking at Flow as well, but it will take time to transition there. In the meantime, is there an easy way to wrap the PnP call using sendbeacon to lower the amount of errors during the transition?

@Arnaud,

No. The only other option I can suggest is to redirect a user to the Edit Form on the stage of filling the form. For example, use the Next button. And then in the Edit form call PnP under spBeforeSave event.

Please see the Redirect user after form submission in SharePoint article for more information.