Qeasy Cloud
Get Started

Return Order Sync in Practice: From Marketing Cloud to Kingdee YXC

· Integration Solutions· 16 views· 4 min read
汤臣倍健营销云金蝶云星辰退货同步供应链集成增量策略轻易云实战

What This Strategy Solves

In retail and FMCG businesses, return documents are the link between frontline stores, the marketing middle office, and the back-office ERP. In one real project, the customer reported: when approved returns in the marketing cloud were entered manually into Kingdee YXC, dozens per store per day piled up into hundreds within three days, and inventory and finance soon drifted apart. The return-inbound sync strategy automates pulling approved returns from the marketing cloud and writing them as inbound documents into Kingdee YXC, so returns hit the books the same day.

Data Flow and Field Mapping

Data flows from the source (marketing cloud) through the Qeasy integration layer for cleansing and mapping, and is then written into the target (Kingdee YXC).

Key field mapping:

Business meaningSource (Marketing Cloud)Middle layerTarget (Kingdee YXC)
Distributor dimensiontenantIdPass-throughUsed as bill source marker
Document numbernumberPass-throughWritten into remark: from Marketing Cloud-{number}
Audit timeauditTimeDate-trimmedbill_date
Customer nameorganNameResolved to internal ID via customer mastercustomer_id
Shipping addressshippingAddressPass-throughcontact_address
Contact personcontactLinkmanPass-throughcontact_linkman
Document statusstatus=1Filter condition, only approvedTriggers write

The middle layer's core responsibility is centralised code-mapping management: customer, item, and warehouse masters are all maintained in Qeasy lookup tables, rather than scattered across each document.

How to Configure It in Qeasy

On the Qeasy data integration platform, this strategy has four typical configuration blocks:

  1. Source API: WebAPI query endpoint /erp/api/order/query/saleReturnOrder, POST. Mandatory tenantId (distributor id) and time window; optional status=1 to restrict to approved documents. idCheck=true enables idempotency to avoid duplicates on rerun.
  2. Target API: Write into Kingdee YXC /jdy/v2/scm/sal_in_bound, POST, with bill_source fixed at ISV; primary key id is used for idempotent write-back.
  3. Field mapping and scripts: date fields use templates such as {{auditTime|date}} for formatting; the customer field uses _findCollection find id from … where name={{organName}} for resolution. This is the typical Qeasy "centralised code-mapping" pattern—change the customer master once, and every dependent strategy picks it up automatically.
  4. Scheduling and dependencies: The strategy depends on upstream customer and item master syncs (sequence A, B); masters must complete before return orders run.

Implementation Steps

We rolled this out on the customer site in three phases:

Phase 1: One-shot full load. Stop manual entry, then run a one-shot backfill over the last seven days of approved returns to validate mapping and lookups. A typical pitfall here: some historical organName values had been renamed in the customer master, so _findCollection returns nothing. The safe practice is to run a "customer master completeness check" before the full load.

Phase 2: Incremental anchor. After the full load, switch the start cursor to {{LAST_SYNC_TIME}} and only pull increments afterwards. Confirm whether the source's beginTime field is based on update time or create time for approved documents—the marketing cloud source supports a timeType switch, defaulting to create time, which is a common gotcha.

Phase 3: Scheduling cadence. Source runs every 8 minutes (*/8 7-23 * * *), target every 7 minutes (*/7 7-23 * * *), staggered to avoid upstream and downstream contending. Active window is 7:00–23:00, aligned with store opening hours; no overnight ingestion reduces dirty data.

Lessons Learned

  1. Time-window field semantics flipped. The marketing cloud defaults to create time, but returns are usually "create first, audit later."Pulling by create time drags in dirty, unapproved rows. Switch timeType to 1 (update time) and add status=1 as a second guard.
  2. Customer code not found. When _findCollection returns nothing, the whole document fails with a generic "customer does not exist" error that doesn't identify the offending record. Configure "failure-reason backfill" in Qeasy so the raw organName is included in the error context for fast triage.
  3. Idempotency key not effective → duplicates. If idCheck=true but the source id changes on incremental rerun (e.g., a return is unaudited then re-audited), duplicate inbound documents appear on the target side. Bind the idempotency key to number+auditTime instead of id alone.
  4. Embedding business info into remarks causes ambiguity. We initially concatenated {{remark}}-from Marketing Cloud-{{number}} straight into the target remark, but the upstream remark occasionally contained line breaks, which truncated the Kingdee-side remark. Clean it in a script first, then concatenate.
  5. Faster scheduling isn't always better. At one point we pushed the interval down to 2 minutes; during return peaks, upstream and downstream queues waited on each other and overall latency actually rose. Returning to a 7/8-minute staggered cadence kept steady-state latency at the minute level.

When It Fits and When It Doesn't

Fits: Marketing cloud → ERP return inbound where document structure is stable, there is a clear approved status, and near-real-time booking is needed for retail/FMCG businesses; customer and item masters already mapped centrally in Qeasy. Does not fit: Source systems without a clear approved status, returns that are frequently unaudited and re-booked, or returns that must be split across bins with detailed body handling—the latter needs stronger staged header/body processing than this lightweight header-body model can support.

Original content. Please credit the source when reposting: https://www.qeasy.cloud/insights/solutions/strat-p158a24-kingdee-cloud-4452-n07d28f65-c6517132

Comments