Shopify Connector / EDI / Master Data Shopify variant option or EDI UOM → BC Sales Line "Unit of Measure Code" (Item Unit of Measure) TrueCommerce KB 11161773 (Internal_InvalidTableRelation ... Item Unit of Measure); dynamicsuser.net thread (same error with the Shopify connector); BCApps Shopify connector source

Sales Line Fails: Unit of Measure Code Cannot Be Found in Item Unit of Measure

Raw System Error String
The field Unit of Measure Code of table Sales Line contains a value (BOX) that cannot be found in the related table (Item Unit of Measure).

What It Means

Business Central cannot create the sales line because the unit of measure sent for the item is not one of that item's units of measure. The order does not become a sales document. In the TrueCommerce connector the message starts with 'Internal_InvalidTableRelation'.

Root Cause

Sales Line 'Unit of Measure Code' must exist in the item's 'Item Units of Measure' list. Shopify: the connector sets the order line's unit of measure from the variant option marked as the UoM option ('UoM as Variant'), and only falls back to the item's Sales Unit of Measure when that is empty (codeunit 'Shpfy Order Mapping'). It then runs SalesLine.Validate("Unit of Measure Code") ('Shpfy Process Order'). If the Shopify option value (for example 'BOX') is not a unit set up on the item, or the item's Sales Unit of Measure itself is not in its list, the validation fails. In the dynamicsuser.net case the item's Sales Unit of Measure did not match its units. EDI (TrueCommerce): the trading partner's UOM was not converted to a BC code in the UOM Conversion table, or both the legacy 'unitOfMeasure' and 'unitOfMeasureCode' fields were mapped and conflicted.

Step-by-Step Fix

  1. Note the code in brackets in the message (for example 'BOX') and the item on the failed line.
  2. Open the item card and choose 'Related' > 'Item' > 'Units of Measure'. If the code is missing, add it with the correct 'Qty. per Unit of Measure' (for example 6 for a box of six). The code must also exist on the 'Units of Measure' page.
  3. Check the item's 'Sales Unit of Measure' field. It must be one of the item's units of measure.
  4. If the code is wrong rather than missing, fix it at the source. Shopify with 'UoM as Variant': rename the variant option value in Shopify to the BC code. TrueCommerce: in Transaction Manager open Trading Partners > the partner > Translations and Lookups > UOM Conversion and map the partner's unit to the BC code.
  5. TrueCommerce Mapping Manager: under Transactions > Sales Order Lines > Details, remove the legacy 'unitOfMeasure' mapping and map only 'unitOfMeasureCode'.
  6. Retry the order. For Shopify: on the Shopify Order card choose 'Create Sales Document'.

Verification Steps

How to verify: The sales document is created, and each line shows a Unit of Measure Code from the item's list with the expected Qty. per Unit of Measure.

Sources & References

Early Access · 30-Day Sandbox Pilot

Stop Order Sync Failures Before Customers Notice

The Order Flow Doctor monitors Microsoft Dynamics 365 Business Central order flows across Shopify, EDI (TrueCommerce, SPS), 3PLs, and carriers. Get automated root-cause diagnosis and one-click fixes.

We respect your privacy. No spam. You will only be contacted when pilot slots open for your stack.