Rebate Order ERP Number Write-Back Strategy: A Closed-Loop Implementation from Yonyou NCC to Fenxiang CRM
What This Strategy Solves
Once a rebate order is approved in the ERP (Yonyou NCC), business users still need to follow up on invoicing, reconciliation, and customer communication in the CRM (Fenxiang). If the ERP document number cannot flow back, manual entry is required on the CRM side, and cross-system reconciliation loses accuracy. A common requirement we see on customer sites is to write back the effective rebate document number and approval status from the ERP to the corresponding CRM record, so that the business side uses the ERP as the final reference. This strategy does not transmit line items; it only performs a lightweight write-back of the document number and status fields.
Data Flow and Field Mapping
The overall flow is: Yonyou NCC (source, polled) → Qeasy Data Integration Platform (intermediate, filtering and mapping) → Fenxiang CRM (target, invoking the data update interface).
| Dimension | Source (Yonyou NCC) | Intermediate Layer | Target (Fenxiang CRM) |
|---|---|---|---|
| Primary Key | id (platform-internal) | internal ID | record object_id (CRM side) |
| Business Number | number (rebate document number) | pass-through | rebate ERP number (custom field) |
| Status | status=2 (completed) | filter only status=2 | process status / approval result |
| Time Window | created_at_begin/end | LAST_SYNC_TIME / CURRENT_TIME | — |
The key points are: status=2 is used as a filter to fetch only completed records, number is passed directly as the write-back field value, and id on the source side serves as the idempotency key.
How to Configure in Qeasy
The source is a query interface and the target is a write interface, which is a typical "query → update" two-stage pattern. When configuring on the Qeasy platform, the strategy is split into source registration, target registration, and mapping orchestration:
- Source registration: API =
QueryStrategyData, method = POST, effect = QUERY. The request body always carriesstrategy_id,status=2,created_at_begin={{LAST_SYNC_TIME}}, andcreated_at_end={{CURRENT_TIME}}. Marknumberas the business number, and enableidCheckonidfor downstream deduplication. - Target registration: API =
/cgi/crm/v2/data/update, method = POST, effect = EXECUTE. The request body consists ofdata(header object),triggerWorkFlow=true, andtriggerApprovalFlow=false. - Mapping orchestration: Write the source
numberinto the ERP-number field inside the targetdata; associate sourceidwith targetdata.object_id. Triggering the workflow but not the approval flow is the safe choice for this kind of lightweight write-back — it prevents secondary approvals on the CRM side that would cause status ping-pong.
Implementation Steps
- Incremental starting point: Initialize
LAST_SYNC_TIMEto midnight on the official ERP rebate go-live date. The first batch is a full pull; subsequent runs are 15-minute increments. - Full-volume trigger: Backfill historical data once, typically via a temporary schedule running overnight; after it completes, switch
LAST_SYNC_TIMEto the current time. - Scheduling frequency: Per the source material's
crontab(*/15 6-23 * * *), run every 15 minutes during business hours and stop at night to reduce ERP pressure. - Exception handling: When the source returns a failure or the target
datais empty, the strategy enters the retry queue; after three consecutive failures, it is escalated to a human.
Lessons Learned
- Do not skip the
statusfilter: An earlier version omittedstatus=2and wrote back records that were still "waiting," which incorrectly triggered CRM workflows and triggered business complaints. The safe approach is to hard-filter on the source query. - Do not use response time for the window: The material leaves
response_at_begin/endempty and uses only thecreated_atwindow, to avoid reprocessing already written-back records. - Centralize code mapping: At one retail customer, the ERP document number and CRM field names did not match. We maintained the mapping table centrally in Qeasy, so adding new regions later only requires new rules — no flow changes.
- Workflow vs. approval trigger: Only trigger the workflow on the CRM side, not the approval flow (
triggerApprovalFlow=false), otherwise already-closed records would be pushed into approval again. - Idempotency key must be enabled: With
idCheckenabled, duplicate data is deduplicated, preventing repeated writes to the same CRM record.
Applicable and Non-Applicable Scenarios
Applicable: ERP is the single source of truth for rebate/expense settlement, CRM is only for follow-up and display, and the ERP document number must serve as the reconciliation anchor. Not applicable: Scenarios with many line items (this strategy only writes back header fields), or bidirectional real-time scenarios that require event-driven rather than scheduled polling.