EDI Orders Arriving Wrong in Business Central: Validate Before the Order Is Created

A staging layer in an AL extension that checks item references, units, prices and duplicates, holds exceptions in a queue for customer service, and keeps the original message exactly as received.

Put a staging layer between the EDI translator and Business Central's sales orders. An AL extension stores every incoming order exactly as received, with its message ID, then copies it into staging tables where a validation codeunit checks it: each line's customer item number, GTIN or barcode resolved through Item References, the unit mapped, the price compared with the customer's price list within an agreed tolerance, and the message ID and customer PO number checked for duplicates. Orders that pass become sales orders. Orders that fail wait in an exception queue with the reason, where customer service resolves them as recorded decisions. The original message is never edited, so every sales order traces back to what was sent.

Why do EDI orders arrive in Business Central with wrong items, prices and duplicates?

Because a direct import turns whatever arrives into a sales order, and EDI messages are only as good as the master data on both sides. Errors are then found by the warehouse, by an invoice dispute or by the customer's compliance penalties, all of them after the order exists and stock has been promised.

  • Item numbers: the customer orders by its own article number or by a GTIN, and the mapping to your item is missing, out of date after a pack change, or points to the wrong unit of measure.
  • Units of measure: the message says cases, your item is held in each, and the conversion is applied twice or not at all.
  • Prices: the customer orders at the price in its own system, which still carries last year's list or a promotion that ended.
  • Duplicates: the EDI provider retransmits an interchange, or the customer resends the same purchase order, and both copies become sales orders.
  • Changes: an amendment arrives as a new order rather than a change message, so the original quantity ships as well.

What does an EDI staging layer in Business Central consist of?

Five parts, all in one AL extension, so they live inside Business Central, use its permissions and survive its updates. The EDI translator, whether an EDI provider or a Microsoft Marketplace (AppSource) app, converts EDIFACT or X12 into a format the extension accepts and delivers it through a custom API page or a file; Business Central does not include a translator for those standards. The extension takes over from there.

PartWhat it holds or does
Inbound message tableThe message exactly as received, with sender, message ID, received time and a hash of the content. Never edited, never deleted.
Staging tablesA header and lines parsed from the message: customer and ship-to identifiers, PO number, dates, customer item numbers, GTINs, quantities, units and prices as sent, plus the values resolved in Business Central.
Validation codeunitRuns every check, writes one result line per failed check with a reason code, and sets the status to valid or exception.
Exception queueA list page for customer service, filtered by reason, customer and age, with actions to resolve, revalidate, release or reject.
Order creationA job queue entry that creates sales orders from valid staging records, writes the sales order number back to staging and the message ID onto the order.

How does the validation codeunit check item references, GTINs and customer item numbers?

It resolves each line through a fixed lookup order and never guesses. A line that cannot be resolved exactly is an exception, because a near match is how a wrong item gets shipped.

  • First, an Item Reference of type Customer for that customer and the customer item number on the line. The reference also carries the unit of measure and variant, which is why it should be the main route.
  • Then, if the line carries a GTIN, an Item Reference of type Bar Code, or the GTIN field on the item card. A GTIN identifies a pack, so the reference must point to the matching unit of measure, not only to the item.
  • Only if the customer has agreed to it, your own item number on the line.
  • The unit of measure on the message is mapped through the International Standard Code on your units of measure, or a mapping table per customer, and the quantity is checked against the unit on the reference.
  • The resolved item must not be Blocked or Sales Blocked, and the variant must exist.
  • The customer and ship-to are resolved by GLN where the message carries one, through the GLN on the customer and, where your version has it, on the ship-to address, or through a mapping table in the extension.

How should prices on an EDI order be checked against the price list?

Compare the price the customer sent with the price Business Central would charge, and let a person decide only when they differ by more than the agreed tolerance. The validation codeunit calculates your price for the customer, item, unit of measure, quantity and order date with the same price calculation a sales line uses, so price lists, customer price groups and line discounts all apply as they would on a manual order. Test that the call matches a manual order on your version before relying on it.

The tolerance belongs in the customer agreement, not in the code alone: zero for some customers, a rounding margin for others, and a rule for which price prevails when the difference is real. Outside the tolerance, the order waits in the queue with both prices shown. Customer service either accepts the customer's price, applies yours and sends the difference back in an order response, or corrects the price list if it was out of date. How customer and project prices are structured in the first place is covered on project pricing and rebates in Business Central.

How do you detect duplicate EDI orders without blocking legitimate repeats?

Check at three levels, each catching a different kind of repeat, and treat each result differently.

CheckKeyCatchesResult
MessageThe interchange control reference (UNB in EDIFACT, the ISA control number in X12) or the provider message ID, plus the content hashA retransmission of the same messageLogged as a duplicate, answered as received, nothing created
Purchase orderCustomer plus the PO number (BGM in an EDIFACT ORDERS message, BEG in an X12 850), checked against staging, open sales orders by External Document No. and posted documentsThe same order sent again as a new messageException: a person confirms it is a repeat or a genuine new order
ContentCustomer, ship-to, delivery date, items and quantitiesAn order resent under a new PO number by mistakeWarning only, because identical orders can be legitimate
  • The standard sales order does not reject a repeated External Document No. on its own, so the check has to live in the extension; confirm the behaviour on your version.
  • Change messages (ORDCHG in EDIFACT, the 860 in X12) are matched to the original order and applied as changes, never created as new orders.
  • Customers that reuse one PO number for several call-offs can be keyed on PO number plus release or line reference instead.

Why must the original EDI message never be altered?

Because it is the evidence. When a customer disputes a delivery or applies a compliance penalty, the question is what they actually ordered, and the only reliable answer is the message as it arrived. If someone has edited it to make it validate, that answer is gone, and so is any way to see whether the fault was theirs or yours.

So corrections never touch the inbound message table. A resolution is stored as its own record against the staging line: the field, the value sent, the value used, the user, the time and a reason code. Revalidation runs the checks again on the staging record with the resolutions applied, and reprocessing can always start again from the original. The sales order carries the message ID, so anyone can go from an invoice line back to the line the customer sent and every decision taken on it.

How does customer service work the exception queue?

The queue is a daily task with an owner, not a log someone reads after a complaint. Each record shows the reason, the customer, the requested delivery date and how long it has waited, so the orders closest to the customer's cut-off are handled first.

  • Unknown item: create the missing Item Reference from the queue, so the same customer item number resolves automatically next time, then revalidate.
  • Price outside tolerance: accept the customer price, apply the price list price, or fix the price list, each recorded with a reason.
  • Possible duplicate: confirm it as a repeat, which closes it without an order, or release it as a genuine new order.
  • Blocked item or customer: resolve with the account manager, never by unblocking just to let the order through.
  • Rejected order: send an order response (ORDRSP in EDIFACT, the 855 in X12) through the translator where the customer accepts them, so the customer learns of the problem before the delivery date.
  • Ageing alert: an email or Teams message when an exception passes an agreed age, before the customer's delivery window is at risk.

Where does this fit with EDI, 3PL and other integrations around Business Central?

The same staging pattern applies to every inbound message: keys that make a second copy harmless, a staging step, an error queue with owners, and a reconciliation. For despatch confirmations and stock from a third party warehouse, the pattern is described on 3PL and WMS integration. For distributors, retailer EDI is one of the extension areas alongside catch weight and quality, as set out on Business Central for food distribution. If the duplicates are in your customer records rather than your orders, see duplicate customers in Business Central, and if items are set up in the wrong unit, see buying in cases and selling single units.

What does Solzet deliver for EDI order validation in Business Central?

Solzet reviews your EDI customers, message types and the errors they have caused, agrees the checks and tolerances with sales and customer service, and builds the staging extension in AL: the inbound message table, staging tables, the validation codeunit, the exception queue, order creation and order responses, connected to your EDI provider or Marketplace app through a custom API page or file. We load the Item References from customer catalogues, test with real messages in a sandbox copy of production, and run old and new side by side before switching over. Our own senior consultants and AL developers do the work. The service line is Dynamics 365 Business Central, and the extension work is described on Business Central AL development. Solzet does not run an EDI network or translator service; we work with the provider you have.

If your sales team needs a customer system and you would rather not carry Microsoft licensing for it, a custom CRM connected to Business Central is an option. We recommend the right solution: Dynamics 365 (Customer Engagement, Business Central or Finance and Operations), Power Platform, or a custom-built CRM. One team for CRM, ERP and the integration between them.

What do people ask us?

Can Business Central validate EDI orders before creating a sales order?

Not as standard, but an AL extension can. It stores each message as received, parses it into staging tables, runs a validation codeunit for items, units, prices and duplicates, and creates the sales order only when every check passes.

How do customer item numbers on EDI orders map to Business Central items?

Through Item References of type Customer, one per customer item number, each with the unit of measure and variant. GTINs map through Item References of type Bar Code or the GTIN field on the item.

How do we stop the same EDI order being created twice?

Check the interchange or provider message ID for retransmissions, and the customer PO number against staging, open sales orders and posted documents for resent orders. The first is discarded automatically; the second goes to the exception queue for a person to confirm.

What happens when the EDI price differs from our price list?

The validation codeunit compares the sent price with the price Business Central calculates for that customer, item, unit, quantity and date. Within the agreed tolerance the order proceeds; outside it, the order waits in the queue with both prices for customer service to decide.

Can customer service correct an EDI order in staging?

Yes, as recorded resolutions against the staging line: the value sent, the value used, who decided, when and why. The original message is never edited, so it remains the evidence in any dispute.

Does Business Central translate EDIFACT or X12 messages?

No. An EDI provider or a Microsoft Marketplace (AppSource) app translates them into a format Business Central can receive. The staging extension takes over after translation.

Does Solzet replace our EDI provider?

No. We build the Business Central side, the staging extension, validation, exception queue and order creation, and connect it to the EDI provider or Marketplace app you already use.

Which solution is right for your business?

Tell us what you need. A senior consultant replies within one business day with a recommendation (Customer Engagement, Business Central, Finance and Operations, Power Platform or a custom-built CRM), not a sales script.