Creating a template for custom or unsupported XML documents
Intro
The Document Capture XML Import module supports the most used international XML document formats out of the box.
This article describes how to create a Master and Identification template to allow the import of custom or unsupported XML documents.
By following the steps in this article, you will be able to create the setup necessary to import
OIOUBL Utility Statement (UTS)
OIOUBL Reminders
SimplerInvoice format
Any XML document
Where to start
It is always best practice that you analyze and understand the structure and data of the custom XML Document you want to create the template for. In some cases, you could find that the XML Document resembles one of the supported XML Documents in Document Capture.
You will have to identify where the document header and the document lines are in the XML structure, together with the information in the XML document that is format specific. This information will be used later when setting the templates.
To create the new templates for the desired XML document, you will have to copy an XML template of the Document Capture supported formats that resemble your custom XML Document. For example, when creating a template for the OIOUBL Reminders, you will get the best results if you make a copy of the OIOUBL and OIOUBL-ID templates.
In the case when none of the supported formats resembles the new XML document, you can always choose to copy the PEPPOL and PEPPOL-ID, since it is one of the most complex templates from where you can remove all the unnecessary setup/fields.
Creating and setting up the Identification template
Follow the next steps:
Navigate to the desired Document Category where you want to create the new templates.
Select the Identification template and press the "Copy..." button from the actions.
In the Copy Template window
Disable Automatic Numbering.
Fill in New Template No. with the desired template code. (make sure to end the code with "-ID").
Edit the newly created Identification template.
Make sure that the value in the Field "After Capture" is "CDC Purch. Doc. - XML Identif." (ID:6086201).
Header and line tag fields
You will now have fill in four important fields on the Identification Template:
Invoice Header Tag
Specifies the XML Path of the location of the document header for invoices (if applicable).
Examples OIOUBL UTS - "/UtilityStatement" OIOUBL Reminder - "/Reminder"
Invoice Line Tag
Specifies the XML path of the location of the document lines for invoices (if applicable).
Examples OIOUBL UTS - "/UtilityStatement/SubscriberConsumption/SupplierConsumption/ConsumptionLine" OIOUBL Reminder - "/Reminder/ReminderLine"
Credit Memo Header Tag
Specifies the XML Path of the location of the document header for credit memos (if applicable). In the case where there is only one document type in the XML format, we just copy the value in Invoice Header Tag.
Examples OIOUBL UTS - "/UtilityStatement" OIOUBL Reminder - "/Reminder"
Credit Memo Line Tag
Specifies the XML path of the location of the document lines for credit memos (if applicable). In the case where there is only one document type in the XML format, we just copy the value in Invoice Line Tag.
Examples OIOUBL UTS - "/UtilityStatement/SubscriberConsumption/SupplierConsumption/ConsumptionLine" OIOUBL Reminder - "/Reminder/ReminderLine"
Format identification Template Fields
The identification of an XML format is done with the help of a points system. When an XML file is imported in Document Capture, the system will run through all the XML templates and calculate the number of points every template scores.
A template will get one point for every Template Field where the XML Path is filled in, and there is a value in the XML document. Additionally, two Template fields are more special when talking about the scoring system:
"XML File Version/Profile Identifier" (Code: VERSIONID)
"XML file identifier" (Code: CUSTOMIZATIONID)
Both these fields score 100 points if the value found at the given XML path corresponds to one of the Rules of the template field. You can find the rules in the Template Field Card. The rules are saved in Table 6085583 CDC Template Field Rule.
Based on the XML document, you will have to edit the XML Path and the Rules of these special Template Fields.
Examples
Template Field
"Xml File Version/Profile Identifier"
XML Path
"/ProfileID"
Rule
"Reference-Utility-1.0"
Template Field
"XML file identifier"
XML Path
"/CustomizationID"
Rule
"OIOUBL-2.02"
Format
OIOUBL Reminder
Template Field
"Xml File Version/Profile Identifier"
XML Path
"/@xmls"
Rule
"urn:oasis:names:specification:ubl:schema:xsd:Reminder-2"
Template Field
"XML file identifier"
XML Path
"/CustomizationID"
Rule
"OIOUBL-2.02"
Vendor identification Template Fields
On most of the XML identification templates, you will find three Template Fields that are used to identify the Vendor related to the imported document:
"GLN No."
Field 90 GLN in Table 23 Vendor*
"VAT Registration No."
Field 86 VAT Registration No. in Table 23 Vendor
"Custom Registration No."
This field is localization specific AT, DE, CH - Field 11000 Registration No. in Table 23 Vendor* AU, NZ - Field 11620 ABN in Table 23 Vendor* BE - Field 11310 Enterprise No. in Table 23 Vendor*
*for older versions of NAV where the field is not available, Table 6086201 is used instead.
The sorting order of these three fields indicates the priority of the identification. For example, if the GLN No. field is first on the list and VAT Registration No. is second, the system will first try to find a vendor using the GLN No. If it cannot find any, it will find a vendor using the VAT Registration No.
You will have to find out wherein the XML document this information exists and update the XML Path of these fields accordingly. You can leave the XML path empty if the data does not exist in the XML Document.
Company identification Template Fields
The Template Fields "Company VAT Registration No." and "Company GLN No." are used to notify the users that the XML Document might not be intended for the current company. The system checks if the values for these fields in the XML Document are the same as the data in Table 79 Company Information in Field 19 VAT Registration No. and Field 90 GLN.
You will have to modify the XML Path to the location where this information is found if you want to be warned, or you can choose to remove the XML Path or delete the template field if you do not want the functionality.
Creating the Master template
Just as the Identification template was copied, the same has to be done for the Master template. A good practice will be to copy the Master template that was related to the Identification template copied previously, but it is not a must.
Follow the next steps:
Navigate to the desired Document Category where you want to create the new templates.
Select the Master template and press the "Copy..." button from the actions.
In the Copy Template window
Disable Automatic Numbering.
Fill in New Template No. with the desired template code (you can use the same name as for the identification template, just without the "-ID" in the end).
Edit the newly created Master template.
Change the XML Identification Template to the previously created Identification template code.
Copy the values of the Invoice Header Tag, Invoice Line Tag, Credit Memo Header Tag, Credit Memo Line Tag fields from the previously created Identification template.
Change the XML Stylesheet according to the new XML format. You can do this from the Template Card by pressing the Import Stylesheet button under the XML action group.
The last step is to set up the Template Fields.
For most of the Template Fields you will just have to modify the XML Path according to the new XML Document. Delete any Template Fields that cannot be applied to the XML Document, or fields you do not wish to use.
Special Template Fields
There are some special Header Template Fields in all XML master templates that do more than just retrieve data.
Specifies the XML Path of the main XML Path and the conditions of the discount data in the XML Document. This field is used later on by the system to suggest eventual Discounts that are missing from the DC Document. If XML document does not have discounts, please delete this Template Field.
"Charges Main Location"
Specifies the XML Path of the main XML Path and the conditions of the charges data in the XML Document. This field is used later on by the system to suggest eventual charges that are missing from the DC Document. If the XML document does not have charges, please delete this Template Field.
"Attachments"
Specifies the XML Path of an attachment embedded in the XML Document as a base64 string.
Last updated
Was this helpful?