Native: Add server logic upon synchronization?

0
Hi, Is there any way to add server logic directly upon synchronization? I am setting isDeleted flags to objects after users delete objects in their offline native app. When a user synchronizes on his app I would like the server to process some logic to delete these objects. Currently I have a scheduled event running which deletes the objects every x interval if it has an isDeleted flag. It would be more logical/convenient to have this logic directly after synchronization, and not a scheduled event. (I believe using isDeleted flags is the way to go when deleting native objects, couldn’t find a better direct approach) Thanks in advance!
asked
4 answers
3

You can use after commit events to run your logic. These will be executed on the server at synchronisation.

answered
1

Only the AfterCreate eventhandler doesn't get triggered is my experience when syncing new objects from the native device. The others (before commit, after commit, after delete, etc) will work.

answered
1

Maybe you should rethink the logic in the after commit and probably place it in a before commit? The delete action should stay in your after commit though.

Another option would be the ‘sync to device’ action which can be used in microflows called from a nanoflow. Then you can perform your logic before syncing.

answered
0

Follow-up question:

The synchronize action has two directions: updating the server database with changes from the local database, and updating the local database with changes from the server database. It has been answered that you can add logic to objects when updating the server database by using event handlers. 

Now I am wondering: is there a way to add logic to objects when updating the native local database with changes from the server? After testing I could see that event handler After Commit does not get triggered when retrieving new data from the server (which makes sense of course, nothing is being commited here). Is there any way to achieve this?

answered