Dynamics NAV Date-time format with SOAP and XML Ports


When developing in dynamics NAV I cam across an annoying issues when trying to run an XML port through the SOAP service. The application was a build server that would, after importing and re-compiling all new objects, run XML ports with new updated data. The PC data time settings were set to dd/mm/yyyy. Dynamics Nav, by default uses mm/dd/yyyy (at least for the North America version). Even after changing the computers date time settings to the proper version (dd/mm/yyyy) the XML port will not run properly through the SOAP service. You will still get an error saying that you have an improper date. To get Dynamics NAV to use your personal settings. Setup your user in Dynamics NAV with the local regional settings you want to use, for us it was EN-CA. Then find your CustomSettings.config file. At the end of this file add in the following key:

<add key="ServicesCultureDefaultUserPersonalization" value="true"/> 

Restart your service and everything should function as you would expect. The SOAP service will now use the personalized data-time format instead of the default one.

This was an issue with NAV 2013R2, not to sure if is was fixed in future versions. Also, you need at least a version of NAV 2013R2 that was built after April 20th, 2013 (Build No. 35212).

One thought on “Dynamics NAV Date-time format with SOAP and XML Ports

  1. Hi Ryan,
    When exporting / importing datetime fields (or decimals values) with an XMLport, you should always use XML-formatting.
    In code this is done using format( dtvalue, 0, 9) and in the XMLPort you have a property Format/Evaluate, this should be set to “XML Format/Evaluate”

Leave a Comment