Register associated records in the offline cache
Configure a write-back action step by adding an execution script that registers newly created instance records for synchronization. Local and server-side records are then reconciled when connectivity is restored, preventing duplicate records.
Before you begin
Role required: mobile_admin, admin
About this task
When a record is created offline, it is assigned a temporary ID that needs to be matched with the permanent ID created on the server once connectivity is restored. You add the addRecordForSync() method to your write-back action step so that the offline and server records are automatically linked during synchronization, preventing duplicate records.
Procedure
Result
When the device reconnects and synchronization occurs:
- The server creates the record during the online step.
- The addRecordForSync() method registers the server record as part of the action result.
- The mobile platform reconciles the locally created record with the server-side record. The device and instance remain consistent without creating duplicate records.
Note:
The addRecordForSync() method can be called multiple times to register multiple records on different tables or on the same table.