If an order arrives by email and ends up in the TMS, there are two separate jobs: reading what the customer sent and deciding whether it's safe to create a load. Automating the first without the second just creates mistakes faster.
This guide covers the second job. It's written for operations and IT leads at 3PLs, brokers and shippers who want orders to reach the transportation management system (TMS) without retyping, and without the new failure modes that come with automation: duplicate loads, wrong windows and records nobody can trace. The examples use a fictional order, EX-1048, and are illustrative only.
Reading is not the same as booking
Most automated order entry projects start by extracting fields from emails and PDFs. That part is now reliable enough for most layouts. What breaks in production is everything around it: an order that was already booked by phone, an amended order that arrives as a new email, a delivery time written as “Friday AM”, or a TMS that times out halfway through a write.
A safe workflow has four stages, and only the first one involves reading:
- Extract the fields, keeping a link to the exact text or PDF line each value came from.
- Validate them against your records and rules: customer account, duplicates, required fields, allowed equipment, time windows.
- Route anything that fails to a named queue with the reason and the source side by side.
- Write and confirm: send the record to the TMS and treat it as created only when the TMS returns a record ID.
The field map
Agree this map before any code is written. Each row needs an owner who can say what happens when the value is missing or doubtful.
| Field | Typical source | Validation | If missing or doubtful |
|---|---|---|---|
| Customer ID | Sender domain, bill-to name, account number in the PDF | Exactly one active account matches | Customer service queue |
| External reference | Subject line, PO or order number | Format matches the customer's pattern; not already used | Stop: identity is required |
| Origin and destination | Email body, PDF address block | Matches a known location or geocodes cleanly | Dispatch queue |
| Contact | Signature, PDF header | Phone or email present for the stop | Draft with a warning |
| Time zone and windows | “Fri 9 to 11”, appointment notes | Explicit start and end in the stop's local time | Dispatch queue (EX-1048 stopped here) |
| Equipment | “53 dry van”, “reefer at 34F” | Maps to an allowed equipment code | Dispatch queue |
| Weight and units | PDF line items | Unit stated; within equipment limits | Stop if the unit is unclear |
| Pieces | PDF line items, “12 pallets” | Count and handling unit agree across email and PDF | Dispatch queue |
| Source link | Message ID, attachment and page | Always stored | Never optional |
API, EDI or approved import
The write path depends on what your TMS and your customers already support. These are integration patterns, not off-the-shelf connectors; each one is scoped against your system's documentation and a test environment.
| Pattern | System access | Acknowledgement | Correction path |
|---|---|---|---|
| API | Scoped service account with create and update rights | Immediate record ID or a specific error | Update the same record by ID; the reason is in the error |
| EDI (for example a 204 load tender) | Trading partner setup, often through a VAN or EDI provider | Functional acknowledgement, then an accept or decline response | Send a change or cancel transaction; partner rules apply |
| Approved import | None beyond the import your team already runs | Import log or a person confirming the batch | Fix in the TMS by hand; record the change against the order |
If a customer already sends structured EDI, don't pass it through an AI model. Map it with rules. Extraction earns its place on the messy inputs: emails, PDFs, portal screenshots and spreadsheets.
Stable order identity
Every order needs an identity that survives retries, forwards and resends. The simplest dependable key is the matched customer account plus the customer's own reference: NHS-204:EX-1048. Store it on the TMS record, or in a lookup table you control if the TMS has no suitable field.
Before each write, and before each retry, look the key up. If a record exists, the workflow treats the incoming email as a possible amendment, not a new order.
Amended orders versus duplicates
The same reference can arrive twice for three different reasons, and each needs a different response:
- Exact resend (same fields, often a forward or a reply-all): log it against the existing order and do nothing else.
- Amendment (same reference, changed window, weight or stop): propose the change against the existing load. Whether it applies automatically depends on the field and the load's status. A changed delivery window on a load that has already been tendered to a carrier should go to dispatch.
- Conflict (same reference, different customer or lane): stop. It's probably a typo or a reused number, and a person needs to decide.
Time zones and windows
“Friday AM” is not a window, and “9:00” means nothing without a place. Store windows in the local time of the stop they belong to, derived from the stop's address, and convert only for display. Text that can't be turned into an explicit start and end time goes to review. In the EX-1048 example the dispatcher confirmed 09:00 to 11:00 local time with the customer before approving.
Who owns each queue
Exceptions only help if somebody works them. Name an owner and a target time for each queue before go-live:
- Customer service: unknown sender, ambiguous account, reference conflicts.
- Dispatch: missing or impossible windows, equipment, stops, piece counts.
- Integration support: TMS rejections that aren't about the order itself (permissions, validation rules, outages).
When the TMS is unavailable
Assume the TMS will time out or go down for maintenance. Validated orders should wait in a durable queue in arrival order. When the TMS returns, each order runs the duplicate lookup again before its write, because a request that timed out may still have succeeded. Operations should be able to see the queue and its oldest item at any time, so that a quiet inbox is never mistaken for a quiet day.
Sample test matrix
| Case | Input | Expected result |
|---|---|---|
| Clean | EX-1048 with explicit window, known customer | Draft created; TMS returns a record ID; source link stored |
| Missing window | EX-1048 with “Friday AM” | Dispatch queue; nothing written until approved |
| Exact resend | Same email forwarded an hour later | Logged against existing order; no second load |
| Amended | EX-1048 with weight changed to 15,000 lb | Change proposed against the existing load; applied or queued by rule |
| Conflict | EX-1048 from a different customer | Customer service queue; no write |
| Rejected | TMS rejects an equipment code | Integration support queue with the TMS error and the source |
| Timeout | TMS times out during the write | Lookup before retry; exactly one load exists afterwards |
| Bad scan | Unreadable PDF page | Review queue; nothing guessed |
Pre-production checklist
Copy this into your project notes and work through it with operations and whoever administers the TMS.
Pre-production checklist: emailed orders to TMS loads [ ] Destination record named (order, load or shipment) and who owns it [ ] Write path agreed: API, EDI or approved import, with a test environment [ ] Service account scoped to create and update only the record types needed [ ] Field map signed off, including required fields and allowed values [ ] Customer account matching rules written down (sender domain, bill-to, reference format) [ ] Order identity defined: customer + customer reference (+ revision if they send one) [ ] Amendment rule: which fields may change after a load exists, and who approves [ ] Time zone rule: windows stored in the stop's local time, ambiguous text goes to review [ ] Duplicate check runs before every write and before every retry [ ] Acknowledgement captured: record ID, timestamp and reviewer kept with the order [ ] Rejection path: TMS error text and the source document go to a named queue [ ] Outage path: orders queue safely when the TMS is down, nothing is double posted on recovery [ ] Queue owners named for dispatch, customer service and billing exceptions [ ] Sample set tested: clean, amended, duplicate, rejected, bad scan [ ] Parallel run agreed, with what counts as a correct result
We build this kind of workflow around existing TMS, WMS and ERP systems. See the logistics automation overview, or read the companion guide on freight invoice processing.
The engineering behind this article is available as a service.
We have done this work — not advised on it, not reviewed documentation about it. If the problem in this article is your problem, the first call is with a senior engineer who has solved it.