Automatic synchronization
Synchronization |
---|
Automatic synchronization (auto sync) in Resco Mobile CRM is a background synchronization that kicks in either when you start the app, when you change the data, or after a defined period of time.
Enable auto sync in the app
Go to the Setup or Settings section of your mobile app and set the following parameters in the Synchronization block:
- Auto Sync: Select when you want your app synchronized:
- Never
- On Start (app will synchronize every time it starts, even after it was running in the background)
- On Change (app will synchronize with server after every data change)
- On Start & On Change
- Background sync: Set to On. This disables the synchronization screen, where you enter URL, name, and password.
The on-start automatic synchronization is initiated at every app startup unless one of the following conditions blocks it:
- Password is not saved
- Sync login is required
- The application was synchronized no more than 15 minutes ago
- No network connection is active
- There are some unresolved sync conflicts from the last sync (it is indicated on the Home screen)
Configure Woodford
Edit your app project and select Configuration from the Project menu.
- Require Sync Login: Set to False.
- Trigger Auto Sync: Set up when (if) should automatic synchronization be performed.
You can optionally configure additional conditions that trigger synchronization:
- Auto Sync Interval: Set up a time period in seconds for automatic synchronization. For example, use 1200 to initiate auto sync when 20 minutes have passed since the end of the previous synchronization. Auto Sync Delay overrides the Auto Sync option and forces the background auto sync.
- Sync before going Online / Sync before going Offline: Perform a synchronization before going into online or offline mode:
- NoAction – Do not synchronize.
- AskUserToSync – Offer the option to synchronize.
- WarnUserMustSync – Require synchronization before continuing.
- ForceSync – Force synchronization.
You have the option to Lock each field. If you do so, the users won’t be able to change these settings in their apps.
Force customization download
An update of the project customization cannot be launched during an automatic, background synchronization. When, during a background synchronization, the app discovers that there's a project update available, the sync button is replaced by a down-facing arrow button. Users can tap the button to start a manual, foreground synchronization that applies the update.
If a user does not trigger foreground sync manually, it will start automatically on application start. As soon as the metadata download (project update) is complete, the sync switches again to background mode, so that the user can start working with the app.
This feature requires that you enable automatic synchronization. Additionally, the option Background Download in Woodford's Configuration must be set to true.
In order for new customization to be applied, all local changes from the device must be uploaded to the server in order to maintain data integrity.
Background sync and data consistency
Background synchronization means that users can continue using the app while the sync is in progress. When both the user and the synchronization process attempt to write to the database at the same time, users are notified and have to wait. However, in rare situations, data integrity problems may occur, for example, when slow business logic on the server is combined with fast user actions. Woodford administrators have tools to prevent or mitigate these issues.
Set up Background sync behavior to select whether you prefer continuous availability of the mobile app (users can freely work with forms while background sync is in progress) or an elevated level of data security at the cost of blocking some user actions. Note that even the standard level of data security is sufficient for most cases.
- Block save during sync - forbids form save while background sync is running. It applies for Save button click as well as invoking form Save via rules or JSBridge. This option favors keeping the schedule of background sync at the expense of potentially slowing down the data entry.
- Block save during sync, don’t start sync while form is opened - blocks background sync while the form is open. If sync is already running, Save is forbidden until sync finishes. This option sacrifices the frequency of background sync, favoring uninterrupted data entry.
- No action - this is the current behavior where concurrent changes in both client and server may (in rare cases) cause data inconsistency or even data loss.
You can set up project-specific default behavior in the app project configuration on the UI tab.
For more fine-grained control, the JSBridge object EntityForm offers functions tryEnterUiTransaction and leaveUiTransaction that can be used to define more granular UI transactions scopes. For example, you can block sync while custom code invoked from a custom button click is modifying and saving related records.
Note | Even if you block saving during sync, the restriction only applies to the entity upload and download phase. Other sync phases such as download of customization, attachments, cloud documents or emails are not blocking. |