Below is a sample code for creating an UBL Invoice Document from Navision (Microsoft Dynamics NAV). Althought the Profile Identifer used here is the one used to identify the Bacic Invoice Only profile, please note that the code below does not create a NES Compliant document according to this profile.
First the invoice and invoiceLine variables are set either locally or globally in the Navision Codeunit variable declarations.

Then here is the code that writes out the invoice to a file.
