Showing posts with label NAV2009. Show all posts
Showing posts with label NAV2009. Show all posts

Thursday, 19 January 2012

Uploading Large Files to RTC

Recently I have had a client attempting to load large files to NAV through RTC.

They are in the process of migrating a company to NAV and have a fairly large number of G/L Entries to load.

We had already developed a generic G/L Journal upload tool so the data had been mapped into a file that could be loaded though that.

When the routine was run we almost immediately got a ‘File is too large error’

After having a dig around I found a setting in the CustomSettings.Config file that limits the size of upload files.

The setting is

    <!--
      Limits the size of files that can be uploaded in order to avoid out of memory errors. This value is in megabytes.
  -->
    <add key="MaxUploadSize" value="5"></add>

The default is 5mb. So by extending this and restarting the service tier larger files can be loaded.

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.

Dynamics CRM – NAV Connector

With the release of NAV2009R2 Microsoft came the release of the Dynamics Connector for NAV and CRM.

The connector itself has been around for a while and was in use with Dynamics GP and CRM. Since it came out with NAV I have had a play with it and I have a couple of sites that are at various stages in implementing it.

Personally I think linking Dynamics NAV with Dynamics CRM gives a very powerful solution. The users access by the method that makes most sense, fairly often we see uses needing to deal with customers or vendors and track interactions but with a limited impact on the ERP. They maybe raising orders or making basic enquires but they don’t need all the functions that the ERP provides.

Often sales wants to be out and about working in an offline capacity. The offline integration with Outlook in CRM makes this possible, plus it presents a familiar interface.

The connector provides out of the box integration for these sorts of things.

NAV-CRM Mapping

The connector itself acts as a mapping tool and uses web services on both sides to handle the integration.

NAV-CRM Overview

While working with it I have found the amount of information on how to add customer fields and tables to the connector to be limited

In the next 3 posts I’ll look at how to setup and customise the connector.

The first will look at Dynamics NAV
The second Dynamics CRM
and finally the third will look in more detail at the connector itself

Friday, 13 February 2009

NAV Web Services

So we have been doing some integration work between a custom piece of development and NAV2009. Our NAV Dev setup some code and exposed it as a series of web services. To test them a simple console app was written and everything was good.
Then they tried running the console app on a different machine to the NAV web service, all of a sudden nothing worked.
We went back over the config settings of the console app and confirmed that it was pointing to the correct URL for the web service, which it was, but for some reason when we ran it it kept trying to look for the service on the localhost. This turned out to be a setting in Visual Studio that by default embeds the URL of the web service when you register it, who knew..... well one of our .NET devs did thankfully. So by changing the GenerateDefaultValueInCode to False your solution will look to the Config file instead.














So after changing that and rebuilding the app we tried again. Still not working. After much testing with little joy we tried some simple tests on a different set of machines, on these we managed to get the following




Turned out that Windows firewall was blocking the port we were using, so after adding an exception to the firewall everything worked fine.
So next time we do some of this stuff we are going to make sure the server has the port unblocked and that we remember to tell Visual Studio not to imbed the web service URL (its default action) so we can control it with a config file.

Tuesday, 2 December 2008

NAV 2009 Released

NAV 2009 has been released in the 'wave 1' counties.  This means some things that we have been waiting for a couple of years for are finally available.

There are still some gaps and the new client will take some getting used to but the addition of web-services out of the box and the new architecture is a great leap forwards.

I have posted before about web-services and since then I have been trying a few different things. In one demo from Microsoft they showed an example of them by adding a 'E#dit in Excel' button to a page that launched Excel, pushed the currently filtered data over and then allowed a user to modify it and update back into NAV.

Another interesting example has been posted by Dave 'Gaspode' Roys. In his example he is using an infopath form to get NAV data, edit it and submit it back to the system. Take a look here.

I am also trying a few things using the new client as well. Generally I 'learn' better when I have a project that needs a solution, fortunately I have a pet NAV project to play with. In our office we have a snack club that I current run, while its overkill really I keep track of it all in NAV. This gives me a chance to try to solve the minor problems that come along, and play with the new cool stuff.

This weeks project was a migration from NAV5.0 to NAV2009. As the basis of the system was fairly standard this was a straight forward exercise, adding a few new fields to tables and the doing a NAV backup and restore to a W2k8 server with SQL2k8 and NAV2009. Then I went through and rebuilt the few special bits of code that I needed.

Next up will be the addition of some RS reports and a simple app that the team can use to record what they are taking and set up their bills, a task that is currently done in a book. Once I have it figured out I'll post some examples.

Tuesday, 7 October 2008

Webservices in NAV2009

Anyone that has been reading up on NAV2009 cannot have failed to have noticed that NAV can now publish Webservices. I know clever developers have been building Webservices for NAV for a while now, but they have been building them from scratch. NAV2009 gives a simple form where you can expose a Codeunit, or a Page(the new object type used by the .NET client).
One of the examples in the Application Developers Guide publishes a Page built against the Customer Table. The example then goes on to build a simple console app that inserts, Modifies and deletes a customer record, displaying the results between each stage.
Now I know very little C# and the example has a number of bugs in it but even I have managed to get this work and add some very basic error catching in a few hours. One of the devs here told me it would have taken him somewhere between a day and 2 days top achieve the same in the past.

So the example I am talking about.
In NAV open Object Designer and run form 810
Add Page 21 and call it Customer

In Visual Studio 2008 I started a ConsoleApp Project.
I then added a reference to the WebService by Right Clicking Service References and selecting Add Service Reference. I then Clicked the Advanced Button

I then clicked Add Web Reference

I then add the webservice and named it WebService(not very original I know)

Once I had this I could start with the C# Code. Admittedly most of this was copy -  pasted from the example. But as I said there are a few bugs that I had to resolve, plus I wanted some simple error trapping
   1: using System;








   2: using System.Collections.Generic;








   3: using System.Text;








   4:  








   5: namespace ConsoleApplication1








   6: {








   7:    // import newly generated Web service proxy








   8:    using WebService;








   9:   








  10:    class Program








  11:    {








  12:        static void Main(string[] args)








  13:        {








  14:            //create instance of service and setting credentials








  15:            Customer_Service service = new Customer_Service();








  16:            service.UseDefaultCredentials = true;








  17:  








  18:            //create instance of customer








  19:            Customer cust = new Customer();








  20:            cust.Name = "Customer Name";








  21:            //Next line will throw an error. Comment out to get successful passing








  22:            cust.Address = "12345678901234567890123456789012345678901234567890123456";








  23:            Msg("Pre Insert");








  24:            PrintCustomer(cust);








  25:           








  26:            //insert customer








  27:            //service.Insert is wrong. Correct and added a Try/Catch for errors








  28:            //service.Insert(ref cust);








  29:            try








  30:            {








  31:                service.Create(ref cust);








  32:            }








  33:            catch (Exception ex)








  34:            {








  35:                Console.WriteLine(ex.Message);








  36:            }








  37:            Msg("Post Insert");








  38:            PrintCustomer(cust);








  39:  








  40:            //create filter for searching for customers








  41:            List&lt;Customer_Filter&gt; filter = new List&lt;Customer_Filter&gt;();








  42:            Customer_Filter nameFilter = new Customer_Filter();








  43:            nameFilter.Field = Customer_Fields.Name;








  44:            nameFilter.Criteria = "C*";








  45:            filter.Add(nameFilter);








  46:  








  47:            Msg("List before modification");








  48:            PrintCustomerList(service, filter);








  49:  








  50:            cust.Name = cust.Name + "Modified";








  51:            //service.Modify is wrong. Correct and added a Try/Catch for errors








  52:            //service.Modify(ref cust);








  53:            try








  54:            {








  55:                service.Update(ref cust);








  56:            }








  57:            catch (Exception ex)








  58:            {








  59:                Console.WriteLine(ex.Message);








  60:            }








  61:  








  62:  








  63:            Msg("Post Modify");








  64:            PrintCustomer(cust);








  65:  








  66:            Msg("List after modification");








  67:            PrintCustomerList(service, filter);








  68:            try








  69:            {








  70:                service.Delete(cust.Key);








  71:            }








  72:            catch (Exception ex)








  73:            {








  74:                Console.WriteLine(ex.Message);








  75:            }








  76:  








  77:  








  78:            Msg("List after deletion");








  79:            PrintCustomerList(service, filter);








  80:  








  81:            Msg("Press [ENTER] to exit program!");








  82:            Console.ReadLine();








  83:        }








  84:  








  85:        static void PrintCustomerList(Customer_Service service, List&lt;Customer_Filter&gt; filter)








  86:        {








  87:            Msg("Printing Customer List");








  88:  








  89:            //conduct the actual search








  90:            //service.Find is wrong. Correct and added a Try/Catch for errors








  91:            //Customer[] list = service.Find(filter.ToArray(), null, 100);








  92:            Customer[] list = service.ReadMultiple(filter.ToArray(), null, 100);








  93:           








  94:            foreach (Customer c in list)








  95:            {








  96:                PrintCustomer(c);








  97:            }








  98:            Msg("End of List");








  99:        }








 100:  








 101:        static void PrintCustomer(Customer c)








 102:        {








 103:            Console.WriteLine("No: {0} Name: {1}", c.No, c.Name);








 104:        }








 105:  








 106:        static void Msg(string msg)








 107:        {








 108:            Console.WriteLine(msg);








 109:        }








 110:    }








 111: }








 112:  
















This is an area I think will make my life a lot easier as I get involved in integration projects fairly often. 








As I get more knowledge I'll post up more examples.