Invoice data transformation logic
Summarize
Summary of Invoice Data Transformation Logic
The Accounts Payable Operations integration with Document Intelligence automates the conversion of invoice and invoice line data into a system-compatible format. This transformation logic ensures that key invoice fields such as type, dates, currency, unit price, and references are accurately interpreted and standardized for processing within ServiceNow.
Show less
Type Deriving Logic
The invoice type is determined based on the presence of a purchase order (PO) value:
- If the PO value exists, the invoice is classified as PO type.
- If the PO value is empty, the invoice is classified as Non-PO type.
Date Conversion Logic
Date formats from the invoice are converted to the ISO standard YYYY-MM-DD. Key points include:
- Supports various date formats such as “2nd Sep, 2022”, “02-Sep-2022”, and numeric formats like “09-02-2022”.
- Recognizes only MM-DD-YYYY numeric formats for conversion; DD-MM-YYYY is not converted if DD is less than 12.
Currency Conversion Logic
The system supports multiple locale currency formats, including US, European, and Indian number systems. It standardizes various currency representations by:
- Recognizing currency codes and symbols with or without spaces (e.g., “76 EUR”, “76€”, “EUR76”).
- Handling number formatting with commas, dots, or other separators for grouping and decimals.
- Determining invoice currency based on purchase order currency for PO invoices or legal entity local currency for Non-PO invoices, defaulting to system currency if necessary.
Unit Price Conversion Logic
Unit prices with currency symbols or codes are converted to a standardized numeric format, supporting locale-specific formats such as “1,00,025.10” or “$1,000,25.10”. This ensures consistent unit price values regardless of invoice origin.
Decimal Conversion Logic
The application interprets decimal and thousand separators based on locale conventions (e.g., European commas as decimals, dots as thousands). It converts values accordingly, but if only a single decimal separator is present, the value is set to empty to avoid incorrect conversions.
Reference Field Value Fetching Logic
The system populates key reference fields on the invoice by applying specific matching rules:
- Legal Entity: Determined from invoice billing address elements in hierarchical order (Bill to company, City, State, Country, Zip).
- Purchase Order: Extracted by cleaning prefixes and matching the remaining value to ERP purchase order numbers.
- Supplier: Matched against the Supplier table with exact or partial name matching combined with address details to identify the correct supplier.
- Country: Taken directly from the invoice or populated with ISO short or long country names if missing.
- Subtotal, Tax, Other Charges: Numeric values are grouped and converted based on decimal separator rules; negative amounts are identified including those indicated by brackets or trailing minus signs, triggering classification as Credit memo invoices.
Practical Benefits for ServiceNow Customers
This transformation logic enables ServiceNow customers to automate invoice data ingestion accurately, reducing manual corrections and errors. It supports diverse invoice formats and international standards, ensuring reliable processing across global operations. By leveraging this logic, customers can expect streamlined accounts payable workflows with enhanced data consistency and compliance.
Accounts Payable Operations integration with Document Intelligence converts the invoice and invoice line field values from the invoice document to a format supported by the system that processes the invoice.
Type deriving logic
The application includes the following logic for deriving the type field on the invoice.
- Considers the purchase order value in the invoice stage record
- If the purchase order value isn’t empty, then the invoice type is set to PO type.
- If the purchase order value is empty, then the invoice type is set to Non- PO type.
Date conversion logic
- Considers YYY-MM-DD as the ISO format and the system format for date conversion.
- Considers dates only in MM-DD-YYYY format for conversion.
- Doesn’t consider dates in DD-MM-YYYY format if DD is less than 12.
| Date format in the incoming invoice | Converted date format |
|---|---|
| 2nd Sep, 2022 | 2022-09-02 |
| 3rd September, 2022 | 2022-09-02 |
| 02-Sep-2022 | 2022-09-02 |
| 02-Sept-2022 | 2022-09-02 |
| Sept-02-2022 | 2022-09-02 |
| Sep-02-2022 | 2022-09-02 |
| 09-02-2022 | 2022-09-02 |
| 02-09-2022 | 2022-02-09 |
| 09/02/2022 | 2022-09-02 |
| 02/09/2022 | 2022-02-09 |
Currency conversion logic
The application supports different locale such as US, European and Indian number systems. For example, "X,XXX.XXX", "X.XXX,XX", "XX,XX.XXX" where X is a single-digit positive number.
| Scenario | Currency format in the incoming invoice | Converted currency format |
|---|---|---|
| Amount followed by a space and the currency code | 76 EUR | 76 EUR |
| Amount followed by a space and the currency symbol | 76 € | 76 EUR |
| Currency code followed by multiple spaces and the amount | EUR 76 | 76 EUR |
| Currency symbol followed by multiple spaces and the amount | € 76 | 76 EUR |
| Amount without a currency code or symbol | 76 | 76 (followed by the purchase order currency or the session currency) |
| Amount separated by comma, dot or any other grouping or decimal separator followed by a space and the currency code | 7.123.456,99 EUR | 7123456.99 EUR |
| Amount followed by the currency code without any space | 76EUR | 76 EUR |
| Amount followed by the currency symbol without any space | 76€ | 76 EUR |
| Currency code followed by the amount without any space | EUR76 | 76 EUR |
| Currency symbol followed by the amount without any space | €76 | 76 EUR |
- PO invoice - Searches for purchase order and related currency, and sets the invoice currency to purchase order currency. In case of missing purchase order or related currency, the invoice currency is set to system currency.
- Non- PO invoice - Searches for legal entity and local currency, and sets the invoice currency to the legal entity's local currency. In the case of missing legal entity and local currency, the invoice currency is set to system currency.
Unit Price conversion logic
The application supports different locale such as US, European and Indian number format locale. For example, "X,XXX.XXX", "X.XXX,XX", "XX,XX.XXX" where X is a single-digit positive number.
If the incoming invoice unit price consists of currency symbol or code present in Currency [fx_currency] table, then the unit price is converted. For example, $ XX,XXX,XXX.XX or USD XX,XX,XXX.X, where X is a single-digit positive number.
| Unit price mentioned in the incoming invoice | Converted unit price |
|---|---|
| 1,000,25.10 | 100025.10 |
| 1,00,025.10 | 100025.10 |
| $1,000,25.10 | 100025.10 |
| 1,000,25.10 $ | 100025.10 |
| USD1,00,025.10 | 100025.10 |
| 1,00,025.10 USD | 100025.10 |
Decimal conversion logic
The application supports different locale such as US, European and Indian decimal format locale. For example, "X,XXX.XXX", "X.XXX,XX", "XX,XX.XXX" where X is a single-digit positive number.
| Decimal format mentioned in the incoming invoice | Converted decimal format |
|---|---|
| 1,000,25.10 | 100025.10 |
| 1,00,025.10 | 100025.10 |
| 100,251 | 100,251 |
| 10.102,510 | 10102.51 |
| 10.10.102,510 | 1010102.51 |
| 100,251 | |
| 100.251 |
Logic to fetch reference field values
| Reference Field | Logic to fetch the field value |
|---|---|
| Legal Entity | The system fetches the value by checking the following values in the order listed:
|
| Purchase Order | The system does the following:
|
| Supplier | The system does one of the following:
|
| Country | The system does one of the following:
|
| Subtotal, Tax amount, Other charges | The system does the following:
|