Jump to content

Synchronization: Difference between revisions

From Resco's Wiki
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Wikipedia|Data synchronization}}
{{Wikipedia|Data synchronization}}
{{Academy|15|Synchronization & Sync Dashboard}}
{{Synchronization TOC}}
{{Synchronization TOC}}
Data synchronization is the process of establishing consistency among data from a source to a target data storage and vice versa and the continuous harmonization of the data over time.  
Data synchronization is the process of establishing consistency among data from a source to a target data storage and vice versa and the continuous harmonization of the data over time.  
Line 23: Line 24:
=== Full vs incremental ===
=== Full vs incremental ===


* Full synchronization - Creating a copy of all server records on the client. This is used when you launch the mobile app for the first time.
* Full synchronization - Download of all server records to the client. This is used when you launch the mobile app for the first time.
* Incremental synchronization - Server sends its changes to the client; client sends its changes to the server.  
* Incremental synchronization - Client uploads its changes to the server and downloads server changes.  


In most cases, full sync is much more resource-intensive than incremental sync. Therefore, full sync is used only when absolutely necessary:
In most cases, full sync is much more resource-intensive than incremental sync. Therefore, full sync should be used only when necessary:
* Full sync is initiated automatically when you change either the server URL or the user name.
* App user can initiate full sync by deleting data ([[Setup#Advanced|Setup form > Advanced > Delete Data]])
* Woodford admin can force full sync using the [[Device control]] tool
* Woodford admin can force full sync using the [[Device control]] tool
* App user can initiate full sync by deleting data ([[Setup#Delete_Data|Setup form > Delete Data]])
* Woodford admin can decide that each change in the [[app project]] results in a full sync. (Woodford [[Configuration]] parameter '''Full Sync on Schema Change'''; in general, we do not recommend enabling this option.)
* Full sync is initiated automatically when the app used DEMO customization before (DEMO customization is applied to the device when user synchronizes at a time when there's no app project assigned for user’s security role in Woodford – you can check this with '''Check User''' button in Woodford)
* In the rare case of a fatal error during an app project upgrade


For all other scenarios, the sync engine decides separately for each table of the database (entity). That means full sync is applied only for the changed entities and not for the entire database. Full sync for an entity is needed:
==== Partial full sync ====
* When you [[App_projects#Managing_entities|add a new entity]]
* When you [[App_projects#Managing_fields|add new fields to an entity]]
* When the new [[Sync Filter]] allows more records to be synced than the older Sync Filer


You can also force full sync for a particular entity using Woodford: edit an [[App_projects#Managing_entities|app project]], select an entity from the '''Project''' menu, set '''Synchronization''' to '''Always Full Sync'''.
Sometimes, the sync engine can decide to full sync only selected entities. This typically happens when a customization update changes the entity definition or when performance reasons dictate that it is better to execute entity full sync instead of inc sync.


If fields are disabled for an entity, full sync is not needed. The disabled column is simply removed from the local database.
During customization update, these are the possible reasons for partial full sync:
* for [[Data_model_in_mobile_apps#Managing_entities|new entities]]
* for [[Data_model_in_mobile_apps#Managing_fields|entities with new fields]] <small>(If fields are disabled for an entity, full sync is not needed. The disabled column is simply removed from the local database.)</small>
* when the entity [[Sync Filter]] has changed.


Additionally, full sync can also be forced, when there are changes in the user’s security role. Resco Mobile CRM highly prioritizes the security permissions from the CRM server. Changing the user’s security role can trigger full sync. The [[security model]] changes include when you:
These are other possible reasons for partial full sync:
* switch the security role of a user
* The sync engine uses a module called SyncAnalyzer to answer the question of whether for a given entity it is better to perform inc sync or full sync.
* modify permissions in a security role
* You can also force full sync for a particular entity using Woodford: edit an [[Data_model_in_mobile_apps|app project]], select an entity from the '''Project''' menu, and set '''Synchronization''' to '''Always Full Sync'''. ([[Synchronization_steps#When_to_use_Always_Full_Sync_for_an_entity.3F|When to use Always Full Sync?]])
* create a new business unit.


When you enable '''Full Sync on Schema Change''' in Woodford [[Configuration]], you force full sync when a new customization changes entities/fields. The default behavior is that first the database schema is updated and then an incremental sync executed.
When there are changes in the user’s security role on the server (for example, the user loses access to an entity), [[Resco Mobile CRM]] has no information about this change. Hence, it is the responsibility of the Woodford administrator to enforce full sync in these cases.


=== Foreground vs background ===
=== Foreground vs background ===
Line 52: Line 52:
* In background mode, users can use the application freely during synchronization. When both the user and the synchronization process attempt to write to the database at the same time, users will be notified and they have to wait.
* In background mode, users can use the application freely during synchronization. When both the user and the synchronization process attempt to write to the database at the same time, users will be notified and they have to wait.


When a new customization is available (new app project published from Woodford), the synchronization must run in foreground.
When a new customization is available (new app project published from Woodford), the synchronization must run in the foreground.
 
(Settings > Sync Login on/off)


=== Manual vs automatic ===
=== Manual vs automatic ===
Line 110: Line 108:


CRM data/customization:
CRM data/customization:
* Dynamics CRM
* Power Platform / Dynamics CRM
** CRM4 (deprecated)
** CRM4 (deprecated)
** CRM5: Dynamics 2011/2015/365; Online / On premise
** CRM5: Dynamics 2011/2015/365; Online / On premise
* [[Resco CRM server]]
* [[Resco Cloud]]
* Salesforce
* Salesforce
* (Oracle)


[[Documents]]
[[Documents]]
Line 122: Line 119:
* Azure cloud storage for attachments
* Azure cloud storage for attachments


Emails
Mail servers
* [[Exchange]]
* [[Exchange]]
* [[Gmail]]
* [[Gmail]]


== See also ==
== See also ==
* [https://blog.resco.net/2018/08/09/quick-overview-resco-mobile-crm-data-synchronization/ Resco Mobile CRM & data synchronization] {{Badge|Blog}}
* [https://www.resco.net/blog/quick-overview-resco-mobile-crm-data-synchronization/ Resco Mobile CRM & data synchronization] {{Badge|Blog}}
* [https://www.resco.net/blog/sync-optimization-tools/ 10 tools to improve your synchronization speed and management] {{Badge|Blog}}
 
 
 


{{Feedback}}
[[Category:Core concepts]] [[Category:Synchronization]]
[[Category:Core concepts]] [[Category:Synchronization]]

Latest revision as of 11:58, 13 February 2025

Wikipedia logo
Wikipedia has an article on a similar subject:
Resco Academy
Resco Academy has a course on a similar subject:

Data synchronization is the process of establishing consistency among data from a source to a target data storage and vice versa and the continuous harmonization of the data over time.

In our case, consistency has to be ensured of the data stored on the CRM server and the data stored on a end user device using Resco Mobile CRM app.

Introduction

When you synchronize your app for the first time, you basically download to the device a subset of the server database. This subset refers to the time instant when it was downloaded. (Or synced last time – hence the name LastSync time. Strictly speaking there is no LastSync time for the database as a whole. Instead, each table has its own LastSync time.)

Once you have the data on the mobile device, you can start using it – view, search, but also create, edit or delete. Of course, the same data items may be changed on the server, too.

The purpose of the synchronization is to

  • Download server changes to the client
  • Upload client changes to the server
  • Resolve eventual conflicts

CRM servers have large databases with a lot of data. Users of the mobile app usually need only a small subset of entities, and they don't need the full set of fields for each record.

Types of synchronization

When talking about data synchronization, we sometimes need to differentiate between its various types.

Full vs incremental

  • Full synchronization - Download of all server records to the client. This is used when you launch the mobile app for the first time.
  • Incremental synchronization - Client uploads its changes to the server and downloads server changes.

In most cases, full sync is much more resource-intensive than incremental sync. Therefore, full sync should be used only when necessary:

  • Full sync is initiated automatically when you change either the server URL or the user name.
  • App user can initiate full sync by deleting data (Setup form > Advanced > Delete Data)
  • Woodford admin can force full sync using the Device control tool
  • Woodford admin can decide that each change in the app project results in a full sync. (Woodford Configuration parameter Full Sync on Schema Change; in general, we do not recommend enabling this option.)

Partial full sync

Sometimes, the sync engine can decide to full sync only selected entities. This typically happens when a customization update changes the entity definition or when performance reasons dictate that it is better to execute entity full sync instead of inc sync.

During customization update, these are the possible reasons for partial full sync:

These are other possible reasons for partial full sync:

  • The sync engine uses a module called SyncAnalyzer to answer the question of whether for a given entity it is better to perform inc sync or full sync.
  • You can also force full sync for a particular entity using Woodford: edit an app project, select an entity from the Project menu, and set Synchronization to Always Full Sync. (When to use Always Full Sync?)

When there are changes in the user’s security role on the server (for example, the user loses access to an entity), Resco Mobile CRM has no information about this change. Hence, it is the responsibility of the Woodford administrator to enforce full sync in these cases.

Foreground vs background

  • In foreground mode, the app displays progress dialog; users must wait until the synchronization finishes
  • In background mode, users can use the application freely during synchronization. When both the user and the synchronization process attempt to write to the database at the same time, users will be notified and they have to wait.

When a new customization is available (new app project published from Woodford), the synchronization must run in the foreground.

Manual vs automatic

  • Manual synchronization is initiated by the app user by tapping the Sync button, or it can be launched via JavaScript.
  • Automatic synchronization can be periodic or triggered by app start or data change.

First synchronization

The very first synchronization is a full synchronization with some additional steps. Client downloads the following:

  1. Customization
  2. Entity records as specified by the customization (they are saved to the database)

The result is a kind of equilibrium:

  • Client has customization that was valid at the time of the last sync.
  • Client has a projection of server data (as defined by the customization) that was valid at the time of the last sync.

Subsequent synchronizations

This equilibrium changes after some time:

  • Client changes: User created or edited some data records; some new records were created automatically (for example audit)
  • Server changes: Someone modified records on the server.
  • Some records might have been changed by both client & server (= conflicts)
  • Woodford might have changed the customization.

The next synchronization (incremental) has the task of restoring the equilibrium:

  1. Upload client changes
    • Identify conflicts (based on record modifiedon attribute)
    • Resolve conflicts if possible. See Conflict resolution for details.
    • Unresolved conflicts are shown in SyncErrors form; respective records are excluded from upload.
    • Client changes (except unresolved conflicts) are uploaded to the Server. Records that fail to upload are also shown in SyncErrors form. (Together with the error message.)
  2. Check for the new customization and try to apply it.
    • New customization may change the data model. This is a non-trivial operation and it cannot be performed during a background synchronization (dangerous for user interface), or if there are not-uploaded changes - conflicts or errors (new customization could delete the changed columns).
    • In these cases the new customization is ignored and the user will be notified about that. (Next time foreground sync will be forced.)
    • If a new customization is available and can be applied => It will be applied.
  3. Finally, download server changes

Result: A new equilibrium between the client and the server with these exceptions:

  • Sync Errors (conflicts, upload failures)
  • Possibly waiting customization that could not be applied. (background sync or unuploaded changes)

See Synchronization steps for a detailed technical description of the synchronization process.

Servers involved in synchronization

Resco license server: iservices.resco.net

  • license
  • external users resolution
  • ApplicationVersionCheckService (responsible for update available notifications)

CRM data/customization:

  • Power Platform / Dynamics CRM
    • CRM4 (deprecated)
    • CRM5: Dynamics 2011/2015/365; Online / On premise
  • Resco Cloud
  • Salesforce

Documents

  • SharePoint
  • DropBox, Box, GoogleDrive, OneDrive
  • Azure cloud storage for attachments

Mail servers

See also



{{#CI form: title = Was this information helpful? How can we improve? | type = inputs | [textarea] }}