NAV 2013 Universal XMLport

NAV 2013 Universal XMLport for MS Dynamics NAV

Quickly import tab-delimited text files into any NAV 2013 table

NAV 2013 Universal XMLportIn a previous post, we introduced a dataport that could be used to quickly bring data into any NAV table without any coding. It’s a great little tool that is almost immediately obsolete with the release of NAV 2013. Luckily, we have a solution for that: the DMS Universal XMLport.

NAV 2013 Universal XMLport for free!

The two biggest problems with the Rapid Start tools are that they’re quite slow, and there’s a bit of a learning curve to get them up and running. Once you have some packages set up for master data, they work great. I expect Microsoft will provide a number of these base packages for different industries, making setup much easier.

Another new option for data import is simply pasting data from Excel into NAV (we’ve been able to do this for years with NavXtender). Pasting from Excel works great for smaller data sets, and I expect to use this feature all the time.

A Simpler Solution
So what do you do if you need to quickly bring a larger dataset into NAV 2013 today? Simple: use the DMS Universal XMLport. NAV 2013 eliminates Dataports, but allows you to run XMLports directly from the RTC. Much like the Universal Dataport, all you need for the XMLport is a tab-separated file (usually generated from Excel or SQL Server Management Studio), and a table number. The XMLport will import all the data from the text file, either inserting new records or updating existing ones. Field validation and disabling the change log are also supported.

Performance of the XMLport in NAV 2013 Beta is not as good as the Dataport in previous NAV versions. This might change with the 2013 final release, but the XMLport speed is generally acceptable – depending on the table, it normally imports up to a few hundred records per second when change logging is off.

To use the XMLport, simply import the object and either add the XMLport to the menu as a Task, or run it directly from the Object Designer. If you add it as a menu item, you can also add it to the ribbon of the Role Center by right-clicking the menu item.

Once running, the XMLport user interface looks like this:

XMLport for MS NAV user interface

Description of Fields:

  • Filename: The name of the tab delimited text file to import. This is optional, as NAV prompts you for a filename when you hit OK anyway. However, if this is filled in, you can just click “Open” when NAV prompts you again.
  • Import table number: The NAV table ID to import data into. If you click the “Assist Edit” button beside the lookup, the XMLport will launch the table you’ve selected – this will open in another instance of NAV.
  • Allow record inserts: If checked, new records will be created.
  • Allow record updates: If checked, existing table records will be updated. This will only work if your file includes the record’s primary key value.
  • Validate fields: If “Only validate fields prefixed with ‘*'” is selected, the NAV data validation logic will only be called for fields that begin with an asterisk on the first row of the import file. If the “Validate all fields” option is chosen instead, the validation logic will be called for all fields.
  • Disable change log: Unlike earlier versions of NAV, NAV 2013 logs programmatic record changes to the change log. If you enable the “Disable change log” option, the XMLport will disable the change log during the import and re-enable it when done (assuming it was originally enabled). This can improve import performance quite a bit.

NAV 2013 Universal XMLport for free!

Sample Import:
A basic import into the NAV “Location” table appears in Excel below:

Importing into Dynamics NAV

The first row tells the DMS Universal XMLport to import values into four NAV fields; “Code”, “Name”, “City” and “Phone No_”. The asterisk in front of the “code” fieldname would indicate to the XMLport to validate this field if the “Validate all fields” option was not enabled. Note that the XMLport will accept field names in the NAV format (using punctuation as in “Phone No.”), or in the SQL format that replaces punctuation with underscores (like “Phone No_”).

Saving this spreadsheet as a tab delimited text file would yield the following file which can be imported into NAV:

*code name City Phone No_
DMS Dynamic Mfg. Solutions Edmonton 780-988-0215

Additional Information:

  • If you’re importing Contacts, you can include the “No.” field in the header row but leave the values blank/empty and the XMLport will automatically use the Contact number series for you. This functionality could be extended to other tables fairly easily.
  • NAV will attempt to validate fields in the order it encounters them (from left to right) so be sure to lay out the import file to avoid validation problems based on field ordering. For instance, if you are importing into the item journal and NAV encounters the quantity field before the item number field the validation will fail with an error.
  • When importing into the Item or Resource table the base unit of measure will automatically be added to the item unit of measure or resource unit of measure table for you, so you can import into these tables in one step.
  • Be careful with tools like Excel that might insert double quotes around columns containing certain text data when it creates a tab delimited text files.
  • Watch out for duplicate data when running with the ”Allow record inserts” option.

NAV 2013 Universal XMLport for free!