cancel
Showing results for 
Search instead for 
Did you mean: 

Draft update collides with Save

RaminS
Active Participant
0 Kudos
155

I have a Smarttable with a bunch of Smartfields in it in edit mode. When a user changes a value in a Smartfield and moves away from that field, as per standard practice I've implemented a validationSuccess event which updates the Draft in the backend (Patch call).

I also have a Save button at the bottom of the page where the user can click to save the Draft (ie. persist in the database and delete the Draft).

This all works well except when the user updates a field and without moving away clicks Save.

Sometimes, the update of the draft happens after the Save, which generates an error because the draft is already deleted.

How can I make sure that Save gets executed after the Patch of the draft? The two Promises are made in different functions in the controller, they don't have a view of whether another promise is waiting to be executed.

Would appreciate any hint on how standard draft-handling works in this scenario.

Thanks.

Accepted Solutions (0)

Answers (0)