Tuesday, 5 July 2011

Dynamics CRM – NAV Connector(NAV Customisations)

Once the connector is installed you need to configure NAV to publish the web services for it.

Step 1 - Setup the connector.

This is fairly straight forward. Go to Marketing Setup and on the Synchronisation tab check the box ‘Enable Connector’ This will then prompt you to confirm that you want to setup the connector and when you OK it will build all the correct Web Service settings and Integration Page records.

When the connector is setup you will see a set of web services inside Dynamics NAV. To check them go to Administration –> IT Administration –> General Setup –> Web Services

image

In the Connector itself

Inside the connector you can see the entities that are coming from NAV by going into the Settings and then selecting the NAV Configuration Utility.

connector settings

Once you have connected to the database and selected the companies from it you which to connect with you will get a list of the published entities from it

connector entities 1

This will give you all the standard tables and fields, but often you will want to add new fields and tables that are specific to the customer

Step 2- Add Custom Fields on tables already mapped

To add a new field to a table already mapped you only need to modify the Page.

Nav Contact

Here I have added Name 2 to the Contact Page

As all the fields on a Page are exposed as the WSDL this will automatically update the list of available fields when you next refresh the Connector

Map Fields 2

Here we can see Name 2 has been added to the source fields list in the connector.

Step 3 - Add Custom Tables

Again this is fairly straight forward.

In order to get the system to automatically add the entries to the Web Services and the Integration Page tables you need to modify Coudeunit 5150. There are 3 functions you need to modify.

EnableConnector

In teh EnableConnector Function you need to add a new line for each new table. This allows the routine to determine what the correct Form and table ID’s are for your new table. If you want to force a specific form you can specify it here.

In this example I am adding the Vendor to the connector

 


EnableConnector()


IF NOT IntegrationPage.FINDFIRST THEN BEGIN


  SetupWebServicePages(FORM::"Resource List",DATABASE::Resource);


  SetupWebServicePages(FORM::"Payment Terms",DATABASE::"Payment Terms");


  SetupWebServicePages(FORM::"Shipment Methods",DATABASE::"Shipment Method");


  SetupWebServicePages(FORM::"Shipping Agents",DATABASE::"Shipping Agent");


  SetupWebServicePages(FORM::Currencies,DATABASE::Currency);


  SetupWebServicePages(FORM::"Salespeople/Purchasers",DATABASE::"Salesperson/Purchaser");


  SetupWebServicePages(FORM::"Customer Card",DATABASE::Customer);


  SetupWebServicePages(FORM::"Item Card",DATABASE::Item);


  SetupWebServicePages(FORM::"Sales Order",DATABASE::"Sales Header");


  SetupWebServicePages(FORM::"Sales Invoice",DATABASE::"Sales Header");


  SetupWebServicePages(FORM::"Posted Sales Invoice",DATABASE::"Sales Invoice Header");


  SetupWebServicePages(FORM::"Units of Measure",DATABASE::"Unit of Measure");


  SetupWebServicePages(FORM::"Ship-to Address",DATABASE::"Ship-to Address");


  SetupWebServicePages(FORM::"Contact Card",DATABASE::Contact);


  SetupWebServicePages(FORM::"Currency Exchange Rates",DATABASE::"Currency Exchange Rate");


  SetupWebServicePages(FORM::"Customer Disc. Groups",DATABASE::"Customer Discount Group");


  SetupWebServicePages(FORM::"Item Disc. Groups",DATABASE::"Item Discount Group");


  //New Table


  SetupWebServicePages(FORM::"Vendor Card",DATABASE::"Vendor");


 


  SetupIntegrationService;


END;


 


MarkDeletedIntegrationRecords;


SetupIntegrationTables;




SetupIntegrationTables



You need to add a new line for each table here





 


SetupIntegrationTables()


InitializeIntegrationRecords(DATABASE::Resource);


InitializeIntegrationRecords(DATABASE::"Payment Terms");


InitializeIntegrationRecords(DATABASE::"Shipment Method");


InitializeIntegrationRecords(DATABASE::"Shipping Agent");


InitializeIntegrationRecords(DATABASE::Currency);


InitializeIntegrationRecords(DATABASE::"Salesperson/Purchaser");


InitializeIntegrationRecords(DATABASE::Customer);


InitializeIntegrationRecords(DATABASE::Item);


InitializeIntegrationRecords(DATABASE::"Sales Header");


InitializeIntegrationRecords(DATABASE::"Sales Invoice Header");


InitializeIntegrationRecords(DATABASE::"Unit of Measure");


InitializeIntegrationRecords(DATABASE::"Ship-to Address");


InitializeIntegrationRecords(DATABASE::Contact);


InitializeIntegrationRecords(DATABASE::"Currency Exchange Rate");


InitializeIntegrationRecords(DATABASE::"Customer Discount Group");


InitializeIntegrationRecords(DATABASE::"Item Discount Group");


//New Table


InitializeIntegrationRecords(DATABASE::"Vendor");




IsIntegrationRecord



You also need to add a reference in here so the system knows that the Table is part of the integration.





 


IsIntegrationRecord(TableID : Integer) : Boolean


IF TableID IN


   [DATABASE::Resource,


    DATABASE::"Payment Terms",


    DATABASE::"Shipment Method",


    DATABASE::"Shipping Agent",


    DATABASE::Currency,


    DATABASE::"Salesperson/Purchaser",


    DATABASE::Customer,


    DATABASE::Item,


    DATABASE::"Sales Header",


    DATABASE::"Sales Invoice Header",


    DATABASE::"Unit of Measure",


    DATABASE::"Ship-to Address",


    DATABASE::Contact,


    DATABASE::"Currency Exchange Rate",


    DATABASE::"Customer Discount Group",


    DATABASE::"Item Discount Group"


    //New Table


    //DATABASE::"Item Discount Group"]


    DATABASE::"Item Discount Group",


    DATABASE::"Vendor"]


 


THEN


  EXIT(TRUE);


 


EXIT(FALSE);




Once this is done you can refresh the integration by Un-checking the  Enable Connector box in Marketing Setup and then rechecking it again. This will refresh the settings. NAV webservices



When you next refresh the connector you will find the new entity



connector entities 2 

















Now the Vendor Card appears in the list of entities and just needs to be enables to be used in a map.

8 comments:

Janet T said...

Thanks for this. We have been struggling with the connector. We followed your example and added the Vendor table and it does appear in the list in the adaptor. However, if we select it, Finish, Apply, Test - it doesn't appear in the entities to Map. If I go back into the adaptor, Vendor is not ticked anymore. Any ideas?

Banda said...

Hi, thanks for the idea, i have added the vendor card by going to the web services and ading the vendor card and enabled and it appears on the adaptor. but when running the connector the vendors are not beign update/added on CRM, where could i be going wrong? the code's sample you have provided where do you run or insert them?

jm said...

Hi,I have the same problem as Janet T. Did anyone figure it out? Thank you!

Konstantin said...

if Table not appear in Connector (become unchecked again after update settings), usually issue with your page. Check in RTC if it works at all

jm said...
This comment has been removed by the author.
jm said...

Thank you for response, we figured it out. There was an issue with how we named our company in NAV. We had special characters in company name so NAV adapter was unable to create a folder to store configuration files. The issue was resolved when we renamed the company.

Michelle said...

I would like to add the Ship-to Name 2 field to the Account to NAV Customer map (and the NAV Customer to Account map) but the field is not being recognized in the connector. I have added a Name 2 field in CRM and this is showing up in the Connector. I have also checked to make sure the Ship-to Address>Name 2 field is accessable on the Ship-to Address Page (300) as well as the Ship-to Address List Page (301). I have rerun the adapter settings in the connector but the All Shipping Addresses>Ship to Address>Name 2 field is not showing up in the Account to NAV Customer Card map. Does anyone have any ideas how to fix this?

Unknown said...

CRM Account map to NAV Customer Card issue

I want to map CRM Accounts to NAV Customer, But facing one issue.

Add/Delete Customers must have a value in User Setup: User ID=EBARA\CRMNAVCONNECTOR. It cannot be zero or empty.

Can any one help me please. It is working fine from Nav Customer to CRM account, but issue when sync CRM Accounts to NAV Customer.