When you are working on offline use one boolean attribute(isDelete) for the object which you are trying to delete.
Try to change that boolean(isDelete) value as true when you processing delete action for that object in offline.
In sync flow, use microflow and retrive objects with isDelete=true as Xpath constraint and delete the retrieved datas.
Hi Balaji Sekar,
Whenever commit the objects using your offline application, everything will be stored in our mobile device local storage. So when the user enables the internet connection, we need to do a Synchronization process to maintain the data consistency. For example, Person A applied for leave using his mobile phone without an internet connection (Offline mode). The same user logging into his same web application. When he checks his leave portal, it should display the created Leave object. For this purpose, we need to do the Synchronization process.
Suppose, user wants to delete the created leave object means, we need to create one boolean attribute in that Entity ( isDeleted ). When a user clicks on the delete button, call the nanoflow to set that particular object's (isDeleted) value from false to true. Add the data source nanoflow to filter the isDeleted = false lists and return that list.
The synchronization process only works, if the user has an internet connection. Otherwise, it will throw an error. If the user wants to do Synchronization process manually, we can use this JS action return value to determine execute the Sycnhronization process or intimate user to turn on internet connection.
Before synchronization process happen, we need to remove the [isDeleted = true()] lists. Because, these lists are needs to be deleted from local storage and continue with Synchronization activity.
Finally, do the Synchronization process like this.
I hope, it will help you.
Thanks and regards,
Calling a nanoflow when there is no connection will cause an error, so always check with the isConnected JS action from NativeMobileResources module before you do that.
But deleting them on the server won't automatically delete on device, so you would need to synchronize everything to remove them from the device.
In most cases we work with an IsDeleted boolean on the object, and filter these objects from views and logic. Then in an event handler microflow on the entity (after commit) check this boolean and delete if necessary when we synchronize everything. We also have access rules on the entity that users can only read/write objects where ‘IsDeleted = false()]. This also prevents the ‘deleted’ objects from getting synced to the device.