Code Mappings
Complete guide to configuring client-to-EDI destination mappings for automated email processing.
Code mappings bridge client names in spreadsheet attachments and the EDI destinations that receive data. When mail rules parse Excel or CSV files, they look up client names (e.g. "FLOH", "CMAD", "CRWH") here to determine routing, picture search window, and optional email notifications.
Table of contents
- Introduction
- What are code mappings?
- Creating and managing mappings
- Multiple destinations per client
- Email notifications
- Fallback mapping
- Autogenerate from YAML
- How it works
- Best practices
- Troubleshooting
Introduction
Centralise client-to-destination relationships so you can update routing without editing individual mail rules. Configure email notifications and fallback destinations for unmatched clients.
What you can do in the Admin UI
- Map client names to one or more EDI destinations
- Set days back for picture search (default: 30)
- Add email notification destinations
- Configure fallback for unknown clients
- Autogenerate many mappings from YAML
- Copy, edit, activate/deactivate, delete mappings
What are code mappings?
A code mapping means: "When processing a spreadsheet row with client name X, send data to EDI destination Y, looking back Z days for pictures."
Example: Client FLOH → EDI FLOH → 30 days back
When processing row client "FLOH" and container "CAIU1234567", the system will:
- Search for pictures with container "CAIU1234567" from the last 30 days
- Send data to the "FLOH" EDI destination
- Send email notification if configured
Key components
| Field | Description |
|---|---|
| Client name | Identifier in spreadsheet rows — case-sensitive |
| EDI destination | Must exist in your EDI destinations list |
| Days back | Picture search window (default: 30) |
| Active | Inactive mappings are ignored |
| Force trigger | For email: send even when pictures are found |
Creating and managing mappings
Create a new mapping
- Click Create mapping
- Enter Client name (must match spreadsheet exactly)
- Select EDI destination
- Set Days back
- Ensure Active is checked
- Click Save
Client names are case-sensitive. "FLOH" and "floh" are different clients.
Edit, copy, delete
- Edit — Pencil icon; for clients with multiple destinations, all destinations save together
- Copy — Duplicate an existing mapping with a new client name
- Delete — Stops routing immediately; consider deactivating instead
Activate and deactivate
- Active — Used when processing spreadsheets
- Inactive — Ignored (useful for testing)
- Use Show only active filter to hide inactive rows
Multiple destinations per client
One client can route to multiple EDI destinations (processed sequentially).
Example: Client CRWH → destinations CRWH and EOS, both 30 days back — both receive data for each matching row.
To add destinations when editing a client, click Add destination, select EDI destination, set days back, and Save.
If one destination fails, others still process.
Email notifications
Add New email as a destination type alongside EDI.
Configuration
- To — Recipient addresses (comma-separated)
- CC — Optional
- Subject template — e.g.
{container} NLRTM10 - Body template — Optional
- Force trigger — See below
Placeholders
| Placeholder | Value |
|---|---|
{container} | Container code from spreadsheet |
{client_name} | Client name |
{terminal} | Terminal code (if available) |
{case_date} | Case date (if available) |
Example: Subject {container} NLRTM10 becomes CAIU1234567 NLRTM10
Force trigger behaviour
| Setting | Behaviour |
|---|---|
| Off | Email sent only if no pictures found |
| On | Email sent always, regardless of pictures |
Use Off to notify when pictures are missing. Use On for notification on every processed container.
Fallback mapping
Used when a spreadsheet row's client name matches no active mapping.
Example: Mappings exist for FLOH, CMAD, CRWH; row has client UNKNOWN → fallback sends to DEFAULT EDI with configured days back.
Create fallback
- Click Create fallback (when none exists)
- Select EDI destination and days back
- Click Save fallback
The fallback appears as a special row at the bottom of the table.
Always configure a fallback to catch typos and new clients.
Autogenerate from YAML
Bulk-create or update mappings by pasting YAML.
YAML format
edi_connections:
- client_name: FLOH
client_edi_name: FLOH
client_days_back: 30
email_notification:
to: "notifications@example.com"
subject_template: "{container} NLRTM10"
send_when_no_pictures: true
- client_name: CMAD
client_edi_name: CMAD
client_days_back: 30
- client_name: CRWH
client_edi_name:
- CRWH
- EOS
client_days_back: 30
YAML fields
| Field | Description |
|---|---|
| client_name | Required |
| client_edi_name | String or list of EDI destination names |
| client_days_back | Default 30 |
| email_notification | Optional: to, cc, subject_template, body_template, send_when_no_pictures |
Steps
- Click Autogenerate
- Paste YAML
- Click Preview — shows create vs update per client
- (Optional) Select mailbox and Generate rule for spreadsheet mail rule
- Click Generate mappings
Existing client names are updated; new names are created.
How it works
- Email arrives with spreadsheet attachment
- Mail rule matches the email
- Spreadsheet is parsed; rows extracted
- For each row:
- Extract client name (via rule column map)
- Look up code mapping → use EDI destination(s) and days back
- If not found → use fallback (if configured)
- Search pictures by container and days back
- Send to EDI and email destinations
- Results logged in Processing state
Code mappings integrate with mail rules that use the parse_spreadsheet action (use_code_mappings enabled by default).
Best practices
- Match client names exactly (case-sensitive) to spreadsheet values
- Always configure a fallback
- Test new mappings with sample spreadsheets
- Use autogenerate for bulk setup
- Review inactive mappings periodically
- Monitor Processing state
- Set minimum days back needed for performance
- Use email notifications sparingly
Troubleshooting
Spreadsheet rows not processed
- Verify mail rule is active and matches email
- Confirm parse_spreadsheet action and
use_code_mappings - Check Processing state for errors
Client name not found / unexpected fallback
- Exact case match on client name
- Check for extra spaces or special characters
- Ensure mapping is Active
- Verify column map in mail rule
Wrong EDI destination
- Verify mapping destination selection
- Check for duplicate mappings for same client
- Ensure EDI destination is active
Email notifications not sent
- Verify New email destination on client
- Check To addresses and Force trigger setting
- Verify SMTP configuration
- Review Processing state for send errors
Autogenerate preview errors
- Valid YAML syntax and indentation (spaces, not tabs)
- Required fields present
- EDI destination names exist
Changes not taking effect
- Click Save after edits
- Mapping must be Active
- Changes apply to new emails only
See also: Mail rules, Processing state, EDI