Mappings: turning an EDI purchase order into the fields your system expects
Every partner sends the same 850 a little differently, and every accounting system wants its own shape. A mapping is the small, testable piece in the middle.
Moving an EDI file from your partner to your systems is the easy half of an integration. The other half is reshaping it: a date written CCYYMMDD has to become a date your software accepts, a warehouse code has to become one of your customers, a case of 12 has to become 12 units. That reshaping is what a mapping does.
What a mapping is
A mapping describes the document your system expects and, for each of its fields, where the value comes from in the EDI document. Each field holds a short expression written in JSONata, an open, documented query language. Most are one line: take this element, reformat this date, look this code up.
| Destination field | Expression | Result |
|---|---|---|
| Order date | $formatDate("20261001", "YYYY-MM-DD") | 2026-10-01 |
| Delivery time | $formatDate("1345", "h:mm A") | 1:45 PM |
| Customer | $lookupTable(12, "0412") | Sumner distribution centre |
| Units ordered | 2 * 12 | 24 |
The examples use literal values so you can read them; in a real mapping each one points at the element in the partner’s document instead.
How you build one
Describe the destination
Paste an example of the JSON your system expects, or its JSON Schema. Weredi turns it into an empty structure with one slot per field, ready to fill.
Write each field with help on hand
The editor completes every JSONata function as you type, with its signature and an example, plus two made for EDI:
$formatDaterewrites EDI dates and times,$lookupTabletranslates a code through one of your tables.Test against a real document
Pick a sample from that partner and the editor shows the value each field produces, how many times each repeating group runs, and any field that comes out empty or invalid, before a single live order goes through it.
Translate codes with lookup tables
When a partner’s code has no match yet, the editor says so and lets you add the line on the spot. The expression is wrapped in
$lookupTablefor you. More on lookup tables.N104PO1TD5
The transformations you’ll actually need
- Dates and times. EDI writes
20261001and1345; your system wants 2026-10-01 and 1:45 PM. - Codes. A store or distribution centre number becomes a customer or ship-to in your books; a carrier code becomes a carrier name.
- Units and quantities. An order in cases becomes units, or the other way round.
- Repeating lines. Every
PO1line becomes a line in your accounting system, however many there are. - Conditions. Use the partner’s ship-to when it is present, your default warehouse when it isn’t.
- Text. Join, trim or split names and references so they fit the destination field.
Start from the connector’s default
The QuickBooks Online, Xero, Sage and NetSuite connections come with a default mapping for each direction and document. You only change what your partner does differently, and you can go back to the default at any time. See ERP and accounting integration.
Mapping in code vs. mapping in Weredi
Hand-written integration
- Each partner difference is a code change and a deployment
- Tested on live orders, after the fact
- Code tables live in a developer’s head or a spreadsheet
A Weredi mapping
- Each field is one expression you can read and change
- Tested against the partner’s own sample before it runs
- Code tables are lookup tables you can edit and extend
Questions
Do I need to be a developer?
No, but it helps to be comfortable with formulas. Most fields take a value as is; the editor completes functions as you type and shows the result on a real document.
What happens when a partner changes its documents?
You change the expression for the field that moved, test it against a new sample from that partner, and save. Nothing else is redeployed.
Which plans include mappings?
Mappings, lookup tables and the accounting connections are part of Weredi Plus and Enterprise, and of every active trial.
Related articles
All articles →Map once, then let every order flow
Mappings and lookup tables are part of Weredi Plus, along with the QuickBooks Online, Xero, Sage and NetSuite connections they feed.