Prepare Structured Document Mapping Instructions
Use this guide to prepare instruction-based mappings for custom CSV and XML invoice documents.
Define Invoice Mapping Instructions
Use this guide to prepare instruction-based mappings for custom CSV and XML invoice documents. It explains how to define invoice structure, map data, apply business rules, and validate results before applying saved learning to production documents.
Before You Start
-
Use a representative source document with stable column names or XML element names.
-
Confirm which field identifies a single invoice and which fields represent individual invoice lines.
-
Make sure the source contains the required invoice data: Supplier, Invoice Number, Invoice Date, Currency, Invoice Amount, and at least one Invoice Line Amount.
-
For purchase order (PO)-matched invoices, include a valid Purchase Order Number where applicable.
Write Mapping Instructions
-
Write instructions in clear, direct sentences. Use the exact source column name or XML element name, state the target invoice attribute, and define the rule at the correct level: once per invoice for header attributes and once per source record for line attributes.
-
Map required attributes first, then optional attributes, defaults, and conditional rules.
-
Use one source attribute for one target attribute wherever possible.
-
For repeated header values in a flat file, require one consistent value for each invoice.
Choose the Right Mapping Approach
|
Approach |
Use When |
Example Instruction |
|---|---|---|
|
Direct mapping |
The source already provides the correct value. |
Map Supplier_Name to Supplier. Map PO_Number to Purchase Order Number. |
|
Fixed mapping |
A value is constant for every eligible invoice. |
Set Business Unit to Vision Operations for all invoices. Set Source to External for all invoices. |
|
Conditional mapping |
The target depends on a source value. |
If Line_Category is Freight, set Invoice Line Type to Freight; otherwise set it to Item. Set Invoice Line Description to Item_Code and Item_Description, separated by a hyphen. |
|
Transformation |
A value must be converted, combined, split, calculated, or standardized. |
Convert Invoice_Date from DD/MM/YYYY to YYYY-MM-DD. |
Use the Standard Mapping Template
Copy this template into the instruction area and replace the text in square brackets with source attributes and business values from your document.
Document grouping:
Create one invoice for all rows with the same [Invoice_Grouping_Key].
Header mappings:
Map [Source_Invoice_Number] to Invoice Number.
Map [Source_Invoice_Date] to Invoice Date.
Map [Source_Supplier] to Supplier.
Map [Source_Currency] to Invoice Currency.
Map [Source_Invoice_Total] to Invoice Amount.
Line mappings:
Create one invoice line for each source row.
Map [Source_Line_Description] to Invoice Line Description.
Map [Source_Line_Amount] to Invoice Line Amount.
Fixed mapping:
Set Business Unit to [Business Unit Name] for all invoices.
Conditional mapping:
If [Source_Line_Category] is [Condition], set Invoice Line Type to [Line Type].
Otherwise, set Invoice Line Type to [Default Line Type].
Transformation:
Convert [Source_Date] from [Source Date Format] to [Required Date Format].
Validation:
Mark records missing [required source attributes].
Map a Flat CSV Invoice File
Use this example when each CSV row represents one invoice line and header information is repeated across lines for the same invoice.
Create one invoice for all rows with the same Invoice_ID.
Header mappings:
Map Invoice_ID to Invoice Number.
Map Invoice_Date to Invoice Date.
Map Supplier_Name to Supplier.
Map Currency_Code to Invoice Currency.
Map Invoice_Total to Invoice Amount.
Line mappings:
Create one invoice line for each source row.
Map Item_Description to Invoice Line Description.
Map Net_Amount to Invoice Line Amount.
Map a Custom XML Invoice File
In Edit Instructions, enter these header and line mappings. Apply header mappings once per Invoice element and create one invoice line for each /Invoice/Lines/Line element.
Enter Mapping Instructions
Header Mappings
Map /Invoice/Currency to Invoice Currency
Map /Invoice/CustomerRegNumber to Tax Registration Number
Map /Invoice/Description to Description
Map /Invoice/InvoiceAmount to Invoice Amount
Map /Invoice/InvoiceDt to Invoice Date
Map /Invoice/InvoiceNo to Invoice Number
Map /Invoice/RequesterEmail to Requester Email Address
Map /Invoice/VendrNm to Supplier
Line Mappings
Map /Invoice/Lines/Line/Amount to Amount
Map /Invoice/Lines/Line/ItemDesc to Item Description
Map /Invoice/Lines/Line/LineNo to Line
Map /Invoice/Lines/Line/LineType to Line Type
Map /Invoice/Lines/Line/Quantity to Invoiced Quantity
Map /Invoice/Lines/Line/UOM to UOM
Map /Invoice/Lines/Line/UnitPrice to Unit Price
Review the XML Mapping Example
The Edit Instructions example below shows the same header and line mappings.
Figure 1. Custom XML header and line mappings in Edit Instructions.
Review Before You Save
-
Confirm every invoice has at least one invoice line.
-
Confirm that line amounts reconcile to the invoice amount, considering tax, freight, discounts, and miscellaneous charges.
-
Confirm that Invoice Line Numbers are unique within each invoice.
-
If source line numbers can repeat, assign unique sequential Invoice Line Numbers based on source row order and retain the original line number only as a source reference.
-
Review the mapped preview and resolve required fields marked for attention.
-
Validate the saved learning with a second representative document that has the same structure.