Process Automation | Integrations
Two-Way Sync: How to Prevent Data Conflicts Between Systems
· 6 min
Two-way sync looks simple on a whiteboard: the CRM and the ERP start talking, and whoever updates a customer in one system sees the change in the other. In practice, it is the kind of integration most likely to corrupt data without anyone noticing.
The connection itself is rarely the problem. The trouble starts when two people edit the same record, in different systems, before the sync runs. This article explains why that happens, how often to expect it, and the five rules we use to prevent data conflicts.
Why two-way sync creates conflicts
In a one-way sync there is always a source and a target. The target never contradicts the source, so conflicts cannot happen.
When data flows both ways, each system is source and target at the same time. And neither of them knows, on its own, which version is correct.
Take the most common scenario. At 10:02, a salesperson changes a customer's phone number in the CRM. At 10:04, accounts changes the same customer's address in the ERP. At 10:05 the sync runs. If the rule is "the most recent record wins", the ERP overwrites the whole record and the new phone number disappears. Nobody gets an error.
That is what makes sync conflicts dangerous: they do not fail, they erase.
How many conflicts to expect: a worked example
Many teams assume collisions are too rare to worry about. It is worth doing the maths before deciding.
What follows is our own estimate for a typical SME, not market data:
- 200 active customers, handled at the same time by sales and finance;
- 60 edits a day in the CRM and 40 in the ERP, across those customers;
- a sync every 5 minutes over an 8-hour day, i.e. 96 windows a day.
The chance that a given customer gets an ERP edit in a given window is 40 ÷ (200 × 96), roughly 0.2%. Multiplied by the 60 daily CRM edits, that gives about 0.125 collisions a day.
That sounds like nothing. Over 225 working days, it is around 28 records a year silently overwritten. And it assumes activity is evenly spread; at month-end, when everyone touches the same customers, the number goes up.
Twenty-eight wrong billing addresses or lost contacts are enough for a team to stop trusting the integration. From then on they check everything by hand, and the investment is wasted.
Rule 1: every field has one owner
The most effective way to prevent data conflicts is to make them impossible. To do that, decide field by field which system is the master.
- Phone, email, account owner: the CRM decides.
- VAT number, billing address, payment terms, credit limit: the ERP decides.
- Customer status: depends on the process, but it needs a single owner.
The two-way sync still works at record level, but each field only travels in one direction. Conflicts become impossible for almost everything.
Commercial tools follow the same logic. HubSpot's Data Sync documentation asks you to pick a default app to resolve discrepancies, and lets you set the direction of each field mapping.
This exercise forces a conversation between departments that usually gets postponed. It is also when you find out that two systems store the same data under different names, one of the signs we describe in 7 signs your company needs digital transformation.
Rule 2: do not let the clock pick the winner
"Last write wins" is the default rule in many connectors. It has two problems.
The first we have already seen: applied to the whole record, it overwrites fields nobody touched. If you must use it, apply it field by field.
The second is the clock. Each system stamps changes with its own time. If the ERP server runs two minutes fast, its changes always "win", even when they came first. And some systems only store the last-modified date to the minute, which makes ties common.
Instead of comparing timestamps across systems, compare versions. For each record, store the value each side had at the last successful sync. If only one side has changed since then, there is no conflict: apply the change. If both have changed, then you have a real conflict to handle.
Rule 3: only write if the record has not changed
Even with the previous rule, there is a risky window: the time between reading the record in the target and writing to it. If someone edits it in between, your write wipes out their change.
The answer is optimistic concurrency. The integration reads the record and receives a version identifier. When writing, it sends that identifier back, and the system only accepts the write if the version is still the same.
Microsoft Dataverse, which underpins Dynamics 365 and Power Apps, does this with ETags. As the Dataverse Web API documentation explains, a request with an If-Match header returns 412 Precondition Failed if the record has changed in the meantime. The integration re-reads and re-evaluates.
The limitation: not every system supports this. Some ERPs do not expose record versions through their API, so check before you design the integration. In those cases, the fallback is to re-read the record immediately before writing and compare it with what you read earlier. It narrows the window, but does not close it.
Rule 4: stop the echo before it becomes a loop
This is the mistake we see most often in a rushed two-way sync.
The integration writes a change to the ERP. The ERP logs a modification and fires a webhook. The integration reads it as a new change and writes it back to the CRM. The CRM fires its own webhook. And so on.
At best, it burns executions and API calls for nothing. At worst, two slightly different values (a rounding difference, a trailing space) bounce between the two systems forever.
Three defences, ideally combined:
- Tag the source. The integration uses its own technical user in each system and ignores changes made by that user.
- Compare before writing. If the target already holds the value you are about to write, write nothing.
- Normalise. Phone numbers in one format, whitespace stripped, dates in one time zone. Without this, step 2 fails.
In n8n, the Compare Datasets node splits records into four outputs: only in A, only in B, same and different. Only the different ones need to go further. We cover the rest of the tool in what n8n is and how it works.
Rule 5: treat deletions and blank fields as special cases
A deletion is not just another edit. If a customer was deleted in the CRM and edited in the ERP in the same window, which one wins? There is no universal answer, but there must be a written one.
Two practices help. Instead of deleting, mark records as inactive: it keeps the history and stops the sync from "resurrecting" them. And when updating, block accidental creation: in Dataverse, If-Match: * makes the write fail if the record no longer exists.
Blank fields deserve the same care. Does an empty field in the master system mean "delete it on the other side" or "not known yet"? HubSpot chose the latter: if the default app has no value, the other side is left unchanged. It is a sensible choice, but you should know that it is the one being made.
What to do with the conflicts that remain
With the five rules in place, few conflicts remain: the rare cases where the same field, with no clear owner, changed on both sides.
Do not resolve them automatically. Send them to a review queue, with both versions side by side, and notify whoever decides. A shared spreadsheet or a Teams channel is enough to start.
If that queue gets more than two or three entries a week, the problem is not technical. It means a field needs an owner, and you go back to rule 1.
When two-way sync is not worth it
Not all data needs to travel both ways. In many cases, a one-way sync with a clear master system covers most of the need for a fraction of the complexity.
Two-way sync is justified when two teams genuinely work the same records in different tools, and neither can switch. If that is your case, design it with the rules above from day one. If you are still choosing what to integrate first, our list of 20 business processes every company should automate helps you prioritise.
Before setting up a two-way sync between the two systems, try a simple exercise: list the fields you want to sync and write, next to each one, which system decides. How many are left without an answer?