Owners, Keys and Staying Consistent Across Orgs
このコンテンツはまだ日本語訳がありません。
Module 3 of 5 in the chapter Multi-Org and Distributed Architecture, chapter 21 of the Integration Architect course. Each module stands on its own. Previous: The Ways Orgs Connect Today · Next: When One Org Fails, and Getting It Back
The question this module answers: When the same customer or order lives in more than one org, how do you keep them matched and in agreement, when both sides can change, and changes can echo back?
Two Questions, Answered Before You Start
Section titled “Two Questions, Answered Before You Start”The Data Architect course puts it plainly: every time an integration touches a record, it has to answer two questions. Which record is this? And whose value is this? (Keys and Write Ownership). Across orgs, both get harder.
Which record? “Record IDs won’t answer it. Each org has its own” (One Org or Many). The same customer has one Salesforce ID in the North America org and a different one in EMEA. So every record that crosses carries a key both orgs agree on, in an External ID field, ideally one that says which system it came from. The Data Architect module shows how, with the source in the value.
Whose value? One owner per field. If the North America org owns a customer’s credit limit, EMEA may show it but never write it. Decide it per field, write it down, and make the integration enforce it.
And for the people, not the records: one identity provider across the orgs, so a person is the same person everywhere. That’s the Identity course’s identity strategy chapter.
If those three are decided, the rest of this module is about keeping the orgs in agreement. If they aren’t, nothing below will save you.
Staying Consistent: Eventually
Section titled “Staying Consistent: Eventually”Here’s the first thing to accept. Between two orgs, there’s no single transaction. A change saved in EMEA is saved in EMEA. It reaches North America later, through whatever mechanism carries the arrow: seconds for an event, an hour for a schedule, the next morning for a nightly load. And if the second org’s save fails, the first one doesn’t roll back (chapter 15 module 3).
That’s called eventual consistency: the orgs will agree, eventually, not at every instant. It’s normal and usually fine. What isn’t fine is pretending the gap isn’t there. So for each arrow, decide:
- How long the gap may be. A credit hold that takes a night to reach the other region may be too slow. A marketing preference may be fine.
- What a user sees in the gap. If a record came from another org, show when it last arrived. A “last updated from EMEA” time tells a user whether to trust it.
- What a process does in the gap. In class I ask: what if one system is up and the other is down? What do you tell the users? Same question here, one org to another.
When Both Sides Change the Same Thing
Section titled “When Both Sides Change the Same Thing”Now the harder case. A customer’s phone number is edited in North America at 10:00, and in EMEA at 10:01, before either change has crossed. Which one wins?
You need a rule, decided before go-live, not discovered in production. Here are the rules I see, from best to riskiest.
- The owning org wins. If each field has one owner, there’s no conflict to resolve: the other org’s edit shouldn’t have been allowed. This is the rule to aim for.
- The later change wins. “Last write wins.” If you use it, compare the time each change happened at its source, not the time it arrived. Change Data Capture gives you that time on every change event, as
commitTimestamp: “The date and time when the change occurred” (ChangeEventHeader Fields (opens in a new tab), Change Data Capture Developer Guide, checked 2026-11-21). Even then, a change that arrives late can overwrite one that’s newer at its destination unless you check. - A person decides. Conflicts go to a queue with both values, and someone with authority picks. Slow, but right for data that matters and rarely conflicts.
Whatever the rule, log every conflict and how it was resolved. The log is how you find out that a rule you thought was rare fires a hundred times a day.
The Change That Comes Back
Section titled “The Change That Comes Back”Here’s the trap that catches almost every two-way integration between orgs.
Org A changes a record. The change goes to org B, and the integration writes it there. But that write is a change in org B, so org B’s Change Data Capture sends it out, and the integration writes it back into org A. That’s a change in org A, which goes to org B again. Round and round, forever, using up API calls and event deliveries in both orgs.
Salesforce gives you the tool to stop it. Every change event carries changeOrigin: the API and the API client ID that made the change, when the client sets one. In Salesforce’s words: “Use this field to detect whether your app initiated the change to not process the change again and potentially avoid a deep cycle of changes.” It also carries commitUser, “The ID of the user that ran the change operation” (same page).
So the integration that writes into an org should:
- Sign in as its own integration user, one for each direction, never a person’s account (chapter 13 module 4).
- Set its client ID on the calls it makes, if it can, so
changeOriginnames it. - Skip any change event that it made itself, by checking
changeOriginorcommitUserbefore sending the change anywhere. - Skip writes that change nothing. If the incoming value already matches, don’t save. No save, no new change event.
Test it on purpose. Change a record in one org and watch: it should arrive in the other org once, and stop.
Check It Every Night
Section titled “Check It Every Night”Even with keys, owners, conflict rules and loop guards, some changes get lost. A message fails after its last retry. A record is edited during an outage. A key is typed wrong at the source. In class I put it this way: you’ll need a nightly refresh or a weekly refresh to catch the one-out-of-a-billion problems.
So every org-to-org arrow gets a reconciliation: a scheduled job that compares the two sides and reports what doesn’t match.
- Count the records each side should share, by key. Different counts mean a record went missing.
- Compare the fields that cross, record by record, or a fingerprint of them. A difference means a change didn’t arrive, or a conflict was resolved the wrong way.
- Report it to the owner, and fix it from the owning side, so the fix flows through the normal integration.
It’s the same idea as chapter 19’s nightly check and chapter 14’s reconciliation, pointed at another org.
Test knowledge. Expect scenarios with data shared between orgs both ways. Know that each org has its own record IDs, so shared records need an External ID both sides recognize; that a field should have one owning system; that bidirectional syncs need loop prevention, for example by ignoring changes made by the integration’s own user or client; and that periodic reconciliation catches what events miss.
What an Architect Decides Here
Section titled “What an Architect Decides Here”- The key every shared record carries, and which system it came from.
- The owner of each field, and that the other orgs can’t write it.
- The gap each arrow may have, and what users and processes do in it.
- The conflict rule, decided before go-live, with every conflict logged.
- The loop guard: the integration’s own user and client ID, and the check that skips its own changes.
- The nightly or weekly reconciliation, and who fixes what it finds.
Explore
Section titled “Explore”- Keys and Write Ownership: Data Architect chapter 9, which record and whose value.
- ChangeEventHeader Fields (opens in a new tab), Change Data Capture Developer Guide (checked 2026-11-26):
changeOrigin,commitUserandcommitTimestamp. - One Org or Many: Data Architect chapter 14, identity across orgs.
