Deleted objects in nanoflow

I am deleting an object in a native app, but when I resigned in I found the same object that has been deleted. I used the selected object mode, but I read that Deleted objects cannot be synchronized using selective synchronization, So how can I solve this issue?
1 answers

Add a boolean-attribute ‘MarkedForDeletion’ to the entity. When you delete it in your native app, instead of deleting it, set this boolean to true.

Also add a before-commit-microflow to the entity, which deletes the object if the boolean is true. Now you can synch the object, and serverside the before-commit-microflow gets triggered, deleting the object from the database.

There is more to this problem, like when you delete the object in native app, but between deleting the object and synchronizing the object to the server, the object might have changed on the server or actions are taken for that object. For instance: a salesman removes an existing salesorder, but before he synchronizes some time later, backoffice-employee has started processing the order. Upon synchronizing the order gets deleted. Now you have to take actions to undo the started order-processing.