Guides

Integrate your CRM, ERP and accounting before adding AI: why and how

Why AI gives wrong answers when data is scattered across CRM, ERP and accounting software, and how to integrate step by step: sources of truth, integration patterns, error handling and Vietnamese e-invoicing under Decree 254/2026.

Quick answer: why integrate CRM, ERP and accounting before using AI?

AI can only answer correctly when the data it reads is correct and consistent. If one customer has three different IDs across your CRM, ERP and accounting software, an AI Agent will miscount receivables, misreport stock or send the wrong quote, no matter how capable the language model is.

The sensible order is: decide which system holds the master record for each type of data, connect systems through a pattern with proper error control, clean the master data, and only then let AI read and act on it. This guide walks through each step, with comparison tables and a section on Vietnamese e-invoicing.

Why AI on fragmented data tends to fail

Many small and mid-sized companies in Vietnam grow by adding separate tools: a CRM for sales, accounting software for finance, an inventory system or ERP for operations, plus spreadsheets. Each system is right within its own scope, but together they disagree.

When AI sits on top of that layer, four failure types keep recurring:

  • Duplicate entities: one customer appears several times with different spellings and a missing or wrong tax code, so the AI cannot tell which record is right.
  • Timing gaps: the CRM marks a deal as won, but the ERP has not shipped and accounting has not invoiced. Depending on when the AI reads, it gets a different answer.
  • Different definitions: “revenue” in the CRM is expected deal value; in accounting it is recognised revenue. An AI summary mixes numbers that do not mean the same thing.
  • No safe write path: if an AI Agent can create orders or update customers without duplicate protection, a single retry can create two orders.

Illustrative example

Illustrative example (not a real client case): a distributor asks its AI assistant “How much does Customer A still owe?”. The CRM holds two records for Customer A, and the accounting system holds one with the full registered legal name. The assistant matches only one CRM record and returns an incomplete balance. The fault is in the data, not the model.

Step 1: pick a source of truth for each entity

A source of truth is the single system allowed to create and edit a type of data; other systems only read it or receive copies. You do not need one system to own everything, but each entity should have exactly one owner.

The table below shows a common split. Yours may differ; what matters is writing the decision down and having every team follow it.

Suggested source of truth per entity (adapt to your actual processes)
EntitySystem of recordSystems receiving copiesFields to standardise
Leads, contactsCRMERP (once a customer), marketing toolsInternal customer ID, email, normalised phone
Legal-entity customer (for invoicing)ERP or accounting softwareCRM (read-only)Registered name, tax code, address
Products, units, list pricesERPCRM, website, sales channelsSKU, unit of measure, tax rate
OrdersCreated in CRM, owned by ERP after confirmationAccounting, warehouseOrder ID, status, customer ID, line items
Invoices, receivablesAccounting / e-invoice softwareCRM, ERP (read-only)Series, invoice number, lookup code, payment status

Ownership hand-over rules

A record can change owner during its life. For example, an order is created in the CRM, but once the customer confirms, the ERP is the only place where quantity and price may change. Document which status moves edit rights to which system, and lock that field in the other one.

Step 2: choose an integration pattern

There are four common integration patterns. None is best for every case; the choice depends on the number of systems, how often data changes and what your team can operate.

Comparison of business software integration patterns
PatternHow it worksFits whenMain risk
Point-to-pointEach pair of systems calls the other's API directlyOnly 2–3 systems with simple flowsConnections multiply as systems are added; no central view of errors
Middleware / iPaaSA central platform receives, transforms and routes data between systemsMany systems needing data mapping and central monitoringDependency on the platform; someone must own the flows
Event-drivenSystems publish “something changed” events; others subscribe and reactSeveral consumers react to the same change; you want less direct couplingHard to see the end-to-end business flow; needs monitoring and duplicate handling
API gatewayA single entry point handling authentication, authorisation and rate limits for internal APIsExposing APIs to partners, mobile apps or AI Agents with controlA central choke point; does not solve data mapping on its own

A note on event-driven architecture

Martin Fowler notes that event notification gives low coupling and is simple to set up, but when a business flow runs across many events it becomes hard to see in the code and is often only understood by monitoring the live system (Martin Fowler). If you choose this pattern, draw the flow and log with correlation IDs from day one.

Combining patterns in practice

Many companies combine them: middleware for syncing customers and products, events for order status changes, and an API gateway as the only layer an AI Agent may call. This separation limits what AI can touch; see access control and audit logs for AI Agents.

Step 3: data mapping and master data clean-up

Data mapping is the table that states which field in system A corresponds to which field in system B, with transformation rules. Master data covers shared entities such as customers, products and suppliers. Both determine the quality of everything downstream, AI included.

  • Catalogue fields per entity: name, data type, required or not, system of record.
  • Unify identifiers: use one internal ID and store each system's ID as a foreign key, instead of matching on names.
  • Normalise formats: phone numbers, tax codes, units, tax rates, currency, time zones.
  • Merge duplicates with review: let software propose pairs and an authorised person confirm before merging.
  • Validate at the point of entry: block records missing required fields when they are entered, not at sync time.

Tie it to data governance

A one-off clean-up is not enough; each entity needs an owner and a process for fixing bad data. See data governance basics for more.

Step 4: idempotency, retries and error queues, explained plainly

Networks drop and target systems go down for maintenance. Good integration is not integration that never fails; it is integration where failures neither create wrong data nor lose data. Three ideas carry most of the weight.

Idempotency: send it twice, get the result once

Imagine you click “create order”, the network hangs, and you click again. If the system cannot tell it is the same request, you get two orders. The common fix is an idempotency key: the sender creates a unique ID for each operation and sends it along; the receiver remembers it and returns the earlier result if it sees the key again.

Stripe documents this in its API reference: it saves the status code and body of the first request for each key, compares parameters of a repeated request against the original and errors if they differ, and keys can be removed once they are at least 24 hours old (Stripe API Reference). When connecting a CRM to an ERP, you can use the CRM order ID as the key so the ERP never creates a duplicate order.

Retries with back-off

Transient errors (dropped connections, overload) should be retried automatically, with growing wait times and some randomness so clients do not all retry at once. Stripe explains adding random “jitter” to avoid a thundering herd of simultaneous retries (Stripe). Errors caused by bad data, such as a missing tax code, will never succeed on retry and should go to an error queue.

Error queue (dead-letter queue)

A dead-letter queue sets aside messages that failed processing so a person or process can inspect, fix and resend them. The Amazon SQS documentation describes maxReceiveCount, the number of times a message can be received from the source queue before it moves to the dead-letter queue, and recommends setting it high enough to allow sufficient retries (AWS). Whatever platform you use, the principle holds: one bad record must not block the whole flow, and someone must be assigned to watch the error queue.

Vietnam context: integrating with e-invoicing

For Vietnamese companies the most sensitive integration point is usually between the ERP or sales system and the e-invoice system, because mistakes have tax consequences. The legal framework changed on 1 July 2026, so review internal documents and software that still cite older decrees.

  • Decree 254/2026/ND-CP, issued 30 June 2026 and effective 1 July 2026, details the Law on Tax Administration No. 108/2025/QH15 on e-invoices and e-documents.
  • Under Article 43(2) of Decree 254, from 1 July 2026 the following ceased to be effective: Decree 123/2020/ND-CP, Article 1 of Decree 41/2022/ND-CP and Decree 70/2025/ND-CP. They are now previous rules only.
  • On the same day the Ministry of Finance issued Circular 91/2026/TT-BTC; according to EY Vietnam, procedures such as registering to use e-invoices are delegated to the Minister of Finance.

What this means for integration

According to Thu Vien Phap Luat's summary of the Appendix to Decree 254/2026, where the digital signing time differs from the invoice issue time, the invoice must be sent for a tax authority code (or, for uncoded invoices, its data transmitted) no later than the next working day after issue, except for certain summary-table submissions. For integration, that means the order-to-invoice flow cannot sit unattended in an error queue for long.

Technically, you should: map buyer details correctly from the customer master record (name, tax code, address); write the invoice series, number and coding status back to the ERP and CRM; alert when an order is delivered but not yet invoiced; and review data formats with your e-invoice provider against new Ministry of Finance guidance. Specific obligations must be checked against the original texts and with your accountant or tax adviser.

Once data is clean: where AI fits

With clear ownership, unified identifiers and integration flows that handle errors, AI starts to add value reliably. Move from read-only to write access step by step:

  • Read-only: answer internal questions on receivables, stock and order status from systems of record, citing the source records.
  • Suggest: AI drafts quotes, proposes duplicate merges, flags delivered-but-uninvoiced orders, for a person to approve.
  • Controlled action: an AI Agent creates draft orders or updates the CRM via the API gateway, with idempotency keys, least privilege and full logs.
  • Keep a human approval step wherever there are financial or tax consequences, following human-in-the-loop principles.

Checklist for business software integration

Before putting AI into production, check the points below. A good starting point is to map an AI workflow to see which flows need integrating first.

  • A source-of-truth table exists for customers, products, orders and invoices and department heads have agreed it.
  • Each entity has one shared internal ID, stored alongside each system's ID.
  • Every write through the integration carries a duplicate-protection key.
  • There is a retry policy for transient errors and a monitored error queue.
  • Logs carry correlation IDs so one order can be traced across every system.
  • The e-invoice flow has been reviewed against Decree 254/2026 and Circular 91/2026.
  • AI Agents access data only through authorised APIs, starting in read-only mode.

Frequently asked questions

What is CRM and ERP integration?

CRM–ERP integration connects a CRM (customers, sales) with an ERP (operations, inventory, finance) so that customers, products, orders and invoices are exchanged automatically and consistently, instead of being re-keyed in each system. It is the foundation that lets AI read one consistent version of the data before it answers or acts.

Should we buy an ERP suite with built-in CRM instead of integrating?

Possibly, if your processes fit that suite and you are ready to migrate. If your current systems serve each department well, integrating via middleware or APIs is usually less disruptive. Either way you still need sources of truth and clean master data.

Does a small business need middleware or iPaaS?

Not necessarily. With two or three systems and simple flows, direct API connections can be enough, as long as you have duplicate protection, retries and a place to capture errors. As the number of systems grows, a central platform makes monitoring easier.

Which decree governs e-invoices in Vietnam in 2026?

From 1 July 2026, Decree 254/2026/ND-CP replaces Decree 123/2020/ND-CP, Decree 70/2025/ND-CP and Article 1 of Decree 41/2022/ND-CP, with Circular 91/2026/TT-BTC providing guidance. Check the original text on the Government Portal.

Can AI be used to clean data before integration?

Yes, AI helps propose duplicates or normalise addresses, but an authorised person should approve merges or edits to master records, especially data used for invoicing.

Share article:
Key point

Integrating CRM, ERP and accounting is not a side project before “doing AI”; it is the foundation that lets AI answer correctly and act safely. Start with a source-of-truth table, choose an integration pattern you can operate, build duplicate protection and error handling, and only then widen what AI Agents may do. If you want a partner to review your current systems and design a roadmap, EYC offers integration consulting, or you can contact EYC. This article is for information only and is not legal advice.

Sources

  1. Nghị định số 254/2026/NĐ-CP quy định chi tiết một số điều và biện pháp thi hành Luật Quản lý thuế số 108/2025/QH15 về hóa đơn điện tử, chứng từ điện tử — Cổng Thông tin điện tử Chính phủ (vanban.chinhphu.vn)
  2. Nghị định số 70/2025/NĐ-CP sửa đổi, bổ sung một số điều của Nghị định số 123/2020/NĐ-CP quy định về hóa đơn, chứng từ — Cổng Thông tin điện tử Chính phủ (vanban.chinhphu.vn)
  3. Chính thức đã có Nghị định thay thế Nghị định 123 và Nghị định 70 về hóa đơn điện tử (Nghị định 254/2026/NĐ-CP) — Thư Viện Pháp Luật
  4. Nghị định 254/2026/NĐ-CP về hóa đơn điện tử và chứng từ điện tử (Bản tin Thuế tháng 7/2026) — EY Việt Nam
  5. Idempotent requests — Stripe API Reference — Stripe
  6. Designing robust and predictable APIs with idempotency — Stripe
  7. Using dead-letter queues in Amazon SQS — Amazon Web Services
  8. What do you mean by “Event-Driven”? — Martin Fowler

Related solutions

Continue reading