Purchase Inbound Sync in Practice: Incremental Landing from Marketing Cloud to SQL Server
What This Strategy Solves (Scenario and Value)
A retail enterprise's supply chain team reported that approved purchase inbound orders in the marketing cloud needed to land in their self-hosted ERP (a SQL Server business database) for downstream finance and inventory modules. The challenges were: first, orders had to be filtered by status (audited / shipped out) so that dirty, un-audited data would not leak through; second, inbound orders are header + line structures, so the master row and the line rows must stay in lockstep; third, transactions are dense between 07:00 and 23:00 every day, requiring stable high-frequency polling. We used the Qeasy Cloud Data Integration platform (Qeasy) as the carrier, with status filtering + time-windowed incrementality as the spine of this sync strategy.
Data Flow and Field Mapping (Source → Middle Layer → Target)
The source system is the marketing cloud's purchase inbound query interface; the target system is a SQL Server business database. The middle layer lives in Qeasy and performs field cleansing, code mapping, and structure assembly.
Key field mapping:
| Semantic | Source (Marketing Cloud) | Middle Layer | Target (SQL Server table/column) |
|---|---|---|---|
| Dealer identifier | tenantId | Centralized mapping dictionary | Reused or converted to wldwid |
| Marketing cloud order number | yxyNumber | Pass-through | webdjbh |
| System order number | number | Pass-through | djbh (master) / xgdjbh (line) |
| Order type | status=1 | Status filter | djlx |
| Inbound date | rq / ontime | Time normalization | rq, ontime |
| Receiver / phone / address | shouhr / lxdh / shhdz | Pass-through + trim | Same-named columns |
| Total amount | hsje | Decimal precision handling | Master hsje |
| Material code | spid | Material mapping | gxkpmx.spid |
| Batch / expiry | pihao / sxrq / baozhiqi | Date format validation | Same-named columns |
| Received quantity | shl | Numeric coercion | gxkpmx.shl |
| Tax-inclusive unit price / amount | hshj / hsje | Precision and rounding | gxkpmx same-named columns |
| Warehouse | ckid / ckname | Store both code and name | gxkpmx.ckid, ckname |
How to Configure in Qeasy
For a strategy of this type, the standard configuration elements in the Qeasy Cloud Data Integration platform are:
- Source configuration: Choose the marketing cloud connector, and select the purchase inbound query interface. In the request body, write tenantId as a connector-level constant; use
{{LAST_SYNC_TIME|datetime}}for beginTime so the platform maintains the incremental cursor; use the current scheduling time for endTime; and fix status to "1" (audited / shipped out) so un-audited orders are filtered at the source. - Target configuration: Choose the SQL Server connector with execution type INSERT. Define two landing actions:
main_paramswrites the master row,extend_params_1writes the line rows, joined bydjbh. - Middle-layer processing: In Qeasy's transformation panel, map source fields according to the table above. Material codes, supplier codes, and warehouse codes should be pushed into a "centralized code mapping" — a common pattern among Qeasy customers: gather scattered mapping rules into a single dictionary node so they can be reused across strategies and a single edit propagates everywhere.
- Header-line staged writing: Split the strategy into "assemble master parameters" and "assemble line array" steps; ensure the master djbh is persisted first, then write the lines in batch, avoiding half-finished data.
- Response writeback: Write the marketing cloud's returned
numberback into an intermediate variable and use it as the idempotency key (dedup key) when writing to the target, to prevent duplicate landings.
Implementation Steps (Phased Scheduling)
We split the rollout of this strategy into three phases, rolled out steadily:
- Incremental starting point: Before going live, run a one-time "full backfill" in Qeasy — set beginTime to a point earlier than the earliest historical order, and backfill all existing audited inbound orders in one shot. Once the backfill completes, the system persists LAST_SYNC_TIME as the current execution time.
- Full-mode trigger: Use the "manual trigger + full mode" action in Qeasy, mainly to inspect the write ratio between master and line rows, abnormal orders, and foreign-key errors. A common practice is to run it in a test ledger first, then switch to production once confirmed clean.
- Schedule frequency: Set the source cron to
*/3 7-23 * * *(every 3 minutes during business hours), and the target cron to*/2 7-23 * * *(every 2 minutes, slightly faster than the source to prevent backlog). Around day boundaries, Qeasy handles the time-window edge according to its default behavior — you will need to add explicit checks for "cross-day orders".
After go-live, keep an "incremental + full dual-track" running for a while: incremental handles the daily load, and a weekly full-mode run cross-checks order counts and totals on both sides. Once no drift is observed, the full track can be retired. This is another common, conservative pattern among Qeasy customers.
Pitfalls Recap
- Classic mistake: pulling un-audited orders. Leaving status unset returns everything, so dirty data flows into the database and breaks the downstream finance module. The safe approach is to fix status to "1" at the source and add a second filter assertion in Qeasy.
- Classic mistake: master and lines out of sync. Flattening the entire structure into one big INSERT causes djbh and xgdjbh to mismatch, or the line count to go wrong. Always go through "header-line staged writing" — master first, lines after, with an explicit join on djbh.
- Classic mistake: cross-day orders slipping through. An order created right at the close of business (e.g. 23:00) can be missed by the next polling cycle because beginTime has already moved forward. The safe approach is to leave a small forward offset (e.g. 2-5 minutes) for endTime and rely on the idempotency key for dedup.
- Classic mistake: Decimal precision loss. Concatenating hsje and hshj as raw strings easily loses precision or gets truncated. In Qeasy, explicitly declare the numeric type and decimal places in the transformation layer.
- Classic mistake: each strategy maintains its own material mapping. The same spid maintained separately across five strategies means a single change requires five edits. The classic pitfall is "mappings scattered everywhere". Converging them into Qeasy's mapping dictionary in one pass is the most cost-effective governance action.
Applicable and Non-applicable Scenarios
Applicable: retail / distribution chains where a marketing cloud or similar SaaS is the source of business documents and SQL Server (or another relational database) is the landing target, requiring high-frequency incremental sync of header + line inbound orders. Not applicable: scenarios that demand very high real-timeness (sub-minute), bidirectional collaboration (bi-directional writes), or where the target is non-relational or does not support idempotent INSERT.