NAV 2009 R2 Setup

In this how-to we will go through how you setup a NAV 2009 R2 based remote system for integration with a Dynamicweb solution.

This covers the following:

Appendix A outlines standard mappings between NAV 2009 R2 data and Dynamicweb data.

To setup the code unit provided by Dynamicweb you must:

  • Install the code unit in NAV
  • Activate the DWWebService
  • Activate the Dynamics NAV Service in Windows

To install the code unit in NAV:

  • Open object designer
  • While the object designer is open, pick files->Import
  • Find the .fob file
  • Click open
  • Click no - this opens the import worksheet window
  • Click ok to import the codeunit
  • Click ok

Codeunit 50100 - "DW WebService" should now be installed.

Select it and click Run to activate the web service.

To activate the Dynamics NAV service in your Windows services:

  • Open control panel
  • Open administrative tools
  • Open Services
  • Find the one called “Microsoft Dynamics NAV Business Web Services”
  • Start it – and consider making it start automatically on boot

Your NAV web service should now be running – check it by accessing http://localhost:7047/DynamicsNAV/WS/Services.

Currently, only the user which installed NAV has access to the web service. Consider setting up a user specifically for accessing the web service, with the relevant rights and permissions in windows and NAV.

To setup the DynamicwebConnectorService you must:

  • Install the service
  • Activate the DynamicwebService in “Services” in Windows
  • Configure the DynamicwebConnectorService

To install the service:

  • Place the DynamicwebConnectorService files where you want them to live – we will use C:\Program Files\DynamicwebConnectorService
  • Locate the installUtil.exe file – it is usually found in the c:\Windows\Microsoft.NET\Framework\vX.X.XXXXX folder, where vX.X.XXXX is the latest version of .NET you have installed. This should be .NET 4.5 or greater
  • Right click on the DynamicwebConnectorService.exe file
  • Select properties, then “unblock”
  • Install the service from the command prompt using installUtil, with the following command: 
c:\Windows\Microsoft.NET\Framework\vx.x.xxxx\installUtil.exe DynamicwebConnectorService.exe

Finally, go to Control Panel > Administrative tools > Services and start the service called DynamicwebService. This exposes the web service to the internet.

The install step will likely require a user that has permission to install the service. If you are on a domain, the user should include the domain. If you are using a user on the local machine, the username should be prefixed with a period and a slash like so: “./Username”

To configure the Dynamicweb Connector, open and edit the .config file located in the DynamicwebConnectorService folder.

<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="NavConnector" type="System.Configuration.NameValueSectionHandler"/> </configSections> <NavConnector> <add key="UserName" value="Navconnector" /> <add key="Password" value="Navconnect1.2" /> <add key="Domain" value="dynamic-systems.lan" /> <add key="NavEndpoint" value="http:// NavMachine:7047/DynamicsNAV/WS/CRONUS%20Danmark%20A/S/Codeunit/DWWebService" /> </NavConnector> <appSettings> <add key="testMode" value="False" /> <add key="TestOutputFile" value="c:\exportContent.xml" /> <add key="Secret" value="472fde90-1b10-44b2-af84-c22425791860" /> <add key="DebugInfo" value="True"/> <add key="WebserviceURI" value="http://localhost:8090/DynamicwebService"/> <add key="ErpConnectorType" value="NavConnectorAddIn.NavConnector"/> </appSettings> </configuration>

In the NavConnector section you must:

  • Change the username, password and domain to match a user which has access to the NAV web service
  • Point the NavEndpoint to the NAV web service – the URL should point to a specific shop. For the Danish Cronus demo database, the URL would look like http://NavServer.url:7047/DynamicsNAV/WS/CRONUS%20Danmark%20A/S/Codeunit/DWWebService

With the appSettings you can:

  • Set testMode to true or false. If set to true, a call to the connector web service will read the content of the file indicated in the TestOutputFile setting
  • Specify a secret, which is used to encrypt traffic between Dynamicweb and the connector. It must be used when setting up scheduled integration tasks in Dynamicweb.

The web service in NAV is called DWWebService. If you rename this, it will cause problems when connecting via the DynamicwebConnector.

If your NAV instance is running on another server/network than your Dynamicweb installation, you must make sure that your network and firewall settings allow connections from the Dynamicweb server to the web service exposed by the Dynamicweb Connector.

Below, you can find a collection of default mappings between NAV 2009 R2 data and Dynamicweb data.

NAV Table

To

DW XML

Customer."No."

->

<column columnName="AccessUserExternalID">

Customer."No."

->

<column columnName="AccessUserCustomerNumber">

Customer.Name

->

<column columnName=" Customer.Name ">

Customer."E-Mail"

->

<column columnName=" AccessUserEmail ">

Customer."Phone No."

->

<column columnName="AccessUserPhone">

Customer."Fax No."

->

<column columnName=" AccessUserFax ">

Customer.Address

->

<column columnName="AccessUserAddress">

Customer."Address 2"

->

<column columnName="AccessUserAddress2">

Customer."Post Code"

->

<column columnName="AccessUserZip">

Customer.City

->

<column columnName="AccessUserCity">

Customer."Country/Region Code"

->

<column columnName="AccessUserCountry">

Customer.Blocked

->

<column columnName="AccessUserActive">

Customer."Home Page"

->

<column columnName="AccessUserWeb">

NAV Table

To

DW XML

country.Code

->

<column columnName="CountryCode2">

NAV Table

To

DW XML

currency.Code

->

<column columnName="CurrencyCode">

currency.Description

->

<column columnName="CurrencyName">

Language.GetUserLanguage

->

<column columnName=" CurrencyLanguageID">

ROUND(100 / “Currency Exchange Rate”.ExchangeRate(TODAY, currency.Code), 1)

->

<column columnName="CurrencyRate ">

NAV Table

To

DW XML

Language.Code

->

<column columnName="LanguageID">

Language.Code

->

<column columnName="LanguageCode2">

Language.Name

->

<column columnName="LanguageName">

NAV Table

To

DW XML

vendor."No."

->

<column columnName="ManufacturerID">

vendor.Name

->

<column columnName="ManufacturerName">

vendor.Address

->

<column columnName="ManufacturerAddress">

vendor."Post Code"

->

<column columnName="ManufacturerZipCode">

vendor.City

->

<column columnName="ManufacturerCity">

vendor."Country/Region Code"

->

<column columnName="ManufacturerCountry">

vendor."Phone No."

->

<column columnName="ManufacturerPhone">

vendor."Fax No."

->

<column columnName="ManufacturerFax ">

vendor."E-Mail"

->

<column columnName="ManufacturerEmail">

vendor."Home Page"

->

<column columnName="ManufacturerWeb">

(EcomStockUnit)

NAV Table

To

DW XML

item."No."

->

<column columnName=" StockUnitProductID ">

itemvariants.Code

->

<column columnName=" StockUnitVariantID">

STRSUBSTNO('Unit_%1',item."Base Unit of Measure")

->

<column columnName=" StockUnitID">

'1'

->

<column columnName="StockUnitQuantity">

 

(EcomVariantsOptions)

NAV Table

To

DW XML

STRSUBSTNO('Unit_%1',”Unit of Measure”.Code)

->

<column columnName="VariantOptionID ">

“Unit of Measure Translation”."Language Code"

->

<column columnName="VariantOptionLanguageID ">

'NavUnits'

->

<column columnName="VariantOptionGroupID ">

Unit  Of Measure Translation.Description

->

<column columnName="VariantOptionName">

 

(EcomVariantGroups)

NAV Table

To

DW XML

'NavUnits'

->

<column columnName="VariantGroupID">

Language.Code

->

<column columnName="VariantGroupLanguageID ">

'DW_Units'

->

<column columnName="VariantGroupName">

''

->

<column columnName="VariantGroupLabel">

'true'

->

<column columnName="VariantGroupUnit">

NAV Table

To

DW XML

item."No."

->

<column columnName="ProductID">

Language (variable) or Languages.GetUserLanguage

->

<column columnName="ProductLanguageID">

Variant (variable) or “ ”

->

<column columnName="ProductVariantID">

item."No."

->

<column columnName="ProductNumber">

description1 (variable)

->

<column columnName="ProductName">

Description2 (variable)

->

<column columnName=" ProductShortDescription">

item."Unit Price"

->

<column columnName=" ProductPrice">

item.Inventory

->

<column columnName=" ProductStock">

item."Net Weight"

->

<column columnName="ProductWeight">

item."Unit Volume"

->

<column columnName="ProductVolume">

item."Vendor No."

->

<column columnName="ProductManufacturerID">

item.Blocked

->

<column columnName="ProductActive">

Variantcount (variable)

->

<column columnName="ProductVariantCounter">

STRSUBSTNO('Unit_%1',item."Base Unit of Measure")

->

<column columnName="ProductDefaultUnitID">

NAV Table

To

DW XML

item."No."

->

<column columnName="ProductID">

Variant (variable)

->

<column columnName="ProductVariantID ">

item."No."

->

<column columnName="ProductNumber">

item.Description or “Item Variants”.Description

 

<column columnName="ProductName">

TempSalesPrice (variable)

 

<column columnName="ProductPrice">

item.Inventory

 

<column columnName="ProductStock">

Currency.Code

 

<column columnName="ProductCurrencyCode">

NAV Table

To

DW XML

'TRUE' or ‘FALSE’

->

<column columnName="OrderCreated">

“Sales Header”."No."

 

<column columnName="OrderID">

“Sales Header”."Currency Code"

 

<column columnName="OrderCurrencyCode">

“Sales Header”."Order Date"

 

<column columnName="OrderDate">

“Sales Header”."Payment Method Code"

 

<column columnName="OrderPaymentMethodName">

“Sales Header”."Shipment Method Code"

 

<column columnName="OrderShippingMethodName">

“Sales Header”."Sell-to Customer Name"

 

<column columnName="OrderCustomerName">

“Sales Header”."Sell-to Address"

 

<column columnName="OrderCustomerAddress">

“Sales Header”."Sell-to Address 2"

 

<column columnName="OrderCustomerAddress2">

“Sales Header”."Sell-to City"

 

<column columnName="OrderCustomerCity">

“Sales Header”."Sell-to Country/Region Code"

 

<column columnName="OrderCustomerCountryCode">

''

 

<column columnName="OrderCustomerEmail">

''

 

<column columnName="OrderCustomerFax">

''

 

<column columnName="OrderCustomerPhone">

“Sales Header”."Ship-to Post Code"

 

<column columnName="OrderCustomerZip">

“Sales Header”."Ship-to Name"

 

<column columnName="OrderDeliveryName">

“Sales Header”."Ship-to Address"

 

<column columnName="OrderDeliveryAddress">

“Sales Header”."Ship-to Address 2"

 

<column columnName="OrderDeliveryAddress2">

“Sales Header”."Ship-to City"

 

<column columnName="OrderDeliveryCity">

“Sales Header”."Ship-to Country/Region Code"

 

<column columnName="OrderDeliveryCountryCode">

''

 

<column columnName="OrderDeliveryEmail">

''

 

<column columnName="OrderDeliveryFax">

''

 

<column columnName="OrderDeliveryPhone">

“Sales Header”."Ship-to Post Code"

 

<column columnName="OrderDeliveryZip">

Order_OrderPriceWithVAT (variable)

 

<column columnName="OrderPriceWithVAT">

Order_OrderPriceWithoutVAT (variable)

 

<column columnName="OrderPriceWithoutVAT">

Order_OrderPriceVAT (variable)

 

<column columnName="OrderPriceVAT">

Order_OrderSalesDiscount (variable)

 

<column columnName="OrderSalesDiscount">

''

 

<column columnName="OrderShippingFee">

NAV Table

To

DW XML

salesLine."No."

->

<column columnName="OrderLineProductNumber">

salesLine."Variant Code"

 

<column columnName="OrderLineProductVariantID">

salesLine."Line No."

 

<column columnName="OrderLineParentLineID">

'3' or '0'

->

<column columnName="OrderLineType">

'1' or salesLine.Quantity

 

<column columnName="OrderLineQuantity">

salesLine."Line Discount Amount" or TempWithWAT (variable)

 

<column columnName="OrderLinePriceWithVAT">

TempWithoutWAT (variable) or salesLine."Line Discount Amount"

->

<column columnName="OrderLinePriceWithoutVAT">

salesLine."Line Discount %"

 

<column columnName="OrderLineDiscountPercentage">

(TempWithWAT-TempWithoutWAT) (variable)

 

<column columnName="OrderLinePriceVAT">

salesLine."VAT %"

->

<column columnName="OrderLinePriceVATPercent">

salesLine."VAT %"

 

<column columnName="OrderLineUnitPriceVATPercent">

salesLine."Line No."

 

<column columnName=" OrderLineID">

salesLine."Unit Price" or salesLine."Unit Price" * (1 + (salesLine."VAT %" / 100))

->

<column columnName=" OrderLineUnitPriceWithVAT">

salesLine."Unit Price" / (1 + (salesLine."VAT %" / 100)) or salesLine."Unit Price"

 

<column columnName="OrderLineUnitPriceWithoutVAT">

(Sales Header)

DW XML

To

NAV Table

<column columnName="OrderCustomerAccessUserExternalId">

->

“Sales Header”."Sell-to Customer No."

<column columnName="OrderCustomerName">

 

“Sales Header”. Sell-to Customer Name"

<column columnName="OrderCustomerAddress">

 

“Sales Header”. Sell-to Address"

<column columnName="OrderCustomerAddress2">

 

“Sales Header”."Sell-to Address 2"

<column columnName="OrderCustomerZip">

 

“Sales Header”."Sell-to Post Code"

<column columnName="OrderCustomerCity">

 

“Sales Header”."Sell-to City"

<column columnName="OrderDeliveryName">

 

“Sales Header”."Ship-to Name"

<column columnName="OrderDeliveryAddress">

 

“Sales Header”."Ship-to Address"

<column columnName="OrderDeliveryAddress2">

 

“Sales Header”."Ship-to Address 2"

<column columnName="OrderDeliveryZip">

 

“Sales Header”."Ship-to Post Code"

<column columnName="OrderDeliveryCity">

 

“Sales Header”."Ship-to City"

 

(Sales Line)

DW XML

To

NAV Table

<column columnName="OrderLineProductID">

->

“Sales Line”."No."

<column columnName="OrderLineQuantity">

 

“Sales Line”.Quantity

<column columnName="OrderLinePriceWithoutVAT">

 

“Sales Line”."Unit Price"

<column columnName="OrderLineUnitPriceWithoutVAT">

 

“Sales Line”."Line Discount Amount"

(Sales Header)

DW XML

To

NAV Table

<column columnName="OrderCustomerAccessUserExternalId">

->

“Sales Header”."Sell-to Customer No."

<column columnName="OrderCustomerName">

 

“Sales Header”. Sell-to Customer Name"

<column columnName="OrderCustomerAddress">

 

“Sales Header”. Sell-to Address"

<column columnName="OrderCustomerAddress2">

 

“Sales Header”."Sell-to Address 2"

<column columnName="OrderCustomerZip">

 

“Sales Header”."Sell-to Post Code"

<column columnName="OrderCustomerCity">

 

“Sales Header”."Sell-to City"

<column columnName="OrderDeliveryName">

 

“Sales Header”."Ship-to Name"

<column columnName="OrderDeliveryAddress">

 

“Sales Header”."Ship-to Address"

<column columnName="OrderDeliveryAddress2">

 

“Sales Header”."Ship-to Address 2"

<column columnName="OrderDeliveryZip">

 

“Sales Header”."Ship-to Post Code"

<column columnName="OrderDeliveryCity">

 

“Sales Header”."Ship-to City"

<column columnName="OrderCurrencyCode">

 

“Sales Header”."Currency Code"

(Sales Header)

DW XML

To

NAV Table

<column columnName="AccessUserName">

->

Customer.Name

<column columnName="AccessUserEmail ">

 

Customer."E-Mail"

<column columnName="AccessUserPhone">

 

Customer."Phone No."

<column columnName="AccessUserFax">

 

Customer."Fax No."

<column columnName="AccessUserAddress">

 

Customer.Address

<column columnName="AccessUserAddress2">

 

Customer."Address 2"

<column columnName="AccessUserZip">

 

Customer."Post Code"

<column columnName="AccessUserCity">

 

Customer.City

<PutUsers GeneralBusinessPostingGroup="Denmark" VatBusinessPostingGroup="Denmark" CustomerPostingGroup="Denmark">

 

Customer."Gen. Bus. Posting Group"

<PutUsers GeneralBusinessPostingGroup="Denmark" VatBusinessPostingGroup="Denmark" CustomerPostingGroup="Denmark">

 

Customer."VAT Bus. Posting Group"

<PutUsers GeneralBusinessPostingGroup="Denmark" VatBusinessPostingGroup="Denmark" CustomerPostingGroup="Denmark">

 

Customer."Customer Posting Group"