I was creating an APP using the Version 10 and I'm having some problems with the synchronisation between Local and Server Data.
What i see that is happening is this:
1- Client A: (locally) Creates new Contact and it has ID 6.
2- Client B: (locally) Also Creates new Contact and it has ID 6.
3- Client A: Syncs Data.
4- Client B: Syncs Data.
5- Server only has Client B New Contact info.
1- Client A: (locally) Creates new Address ID 9
2- Client A: (locally) Creates new Contact ID 8 with a reference to Address ID 9
3- Client A: Syncs Data
4 - Server creates new Address but the create function returns ID 5 (since the Address Table has the ID set to auto-number, and it doesn't have enough records in it)
5- Server creates new Contact and this Contact's reference to Address is 9 which is the wrong reference.
Both of this issues are supposed to be avoided by the Developer or are they being addressed in this new Version?
Thanks in advance,
Both issues need to be addressed by the Developer in a case-by-case basis, as they are not addressed automatically in this new version.
In both scenarios, the recommendation is to only use Ids from the Client when you're sure they've come from the server originally.
In Scenario 1, you should either use a Create entity action (which will automatically ignore the Id you pass), or explicitly pass a NullIdentifier() as Id if you're invoking CreateOrUpdate. That will ensure both records are effectively different.
In Scenario 2, you need to take the same care with the Id of Address and Contact, and ensure that you correct the AddressId in the Contact before creating it.
In the platform documentation you can find several synchronization examples, useful to understand common synchronization patterns and details to account for:
Thanks alot for your help, I managed to resolve the synchronisation process!