Friday, January 18, 2013

Part 2, step by step developing Navision objects.

Integrating Visual Studio 2012 LightSwitch and Dynamics NAV OData (Part 1) 

1- Build Dynamics NAV 2013 objects
Create SalesPersons Query object to include Customers count attribute:

From NAV Object Designer click on Query button, then click new button.
Enter Salesperson/Purchase in first DataItem Date Source Column, next DataItem Row enter Code & Name Columns.


Add New DataItem under Name Column and pick (or type) Customer in Data Source Table, then add another column under Customer DataItem but don't pick DataSource for this column, in Method Type pick Totals and in Method pick Count and change Name field to Customers.

Select DataItem Customer and View menu, Properties command (or Shift+F4) to bring the properties dialogue box. Set DataItemLink as shown below.

Click OK button and X out Customer - Properties window.

Save the Query with ID = 50010 and Name = wsSalesPerson

Now we are going to create Customer Page and expose the fields we want in it. You may use existing Customer List page (ID = 22), but its better practice to create a new page so we don't have to expose all the fields in Customer List Page.

The reason we will be using a page object to expose to customer data is to enable Customer edit in the future (not covered in this blog), as you used Query object then you will have only read only ability.
Start a new page, pick Customer for Table field and List for wizard type, and then click OK.

Select the desired fields from Available fields list and add to Field order List, No. and Sales Person Code must be selected for our example to work.

Click Finish button, and Save the page with ID= 50010 and Name = wsCustomerList.

2- Expose NAV objects as web services

Launch NAV RTC client, click on Departments, Administration, IT Administration, General, and web services link.


Click New and add Query and Page objects with ID 50010 and Name as shown below. Don't forget you need to check Publish check box.

Click ok.

Now we have completed the MS Dynamics NAV 2013 steps (Part 2), part 3 will cover Visual Studio 2012 LightSwitch HTML Client part.

Step by step developing Visual Studio 2012 LightSwitch application (Part 3)


  1. Thank you for your tutorial. I would like to accomplish inserting data into Navision 2013 from Sharepoint 2010. Could you give me some advice?
    Thank you in advance

    1. You welcome Goran, the answer to your question will be in 2 parts:
      NAV 2013: Since you want to update then you may only use Pages or Codeunits as web services in NAV. This link may further help:

      Sharepoint 2010: I’m going to assume you want to build some screens in Sharepoint for users to enter some data that will be saved to NAV and if that is the case one of the options if you are ok with ASP.NET will be to build Visual web parts project in Visual Studio 2010 or Visual Studio 2012 and call NAV web services.

    2. For Dynamics NAV 2013 you will also need to consider Dynamics NAV Sharepoint Client, so really it depends on the requirements.

    3. Thank you so much for your quick response and thoughtful explanation. I will be checking your blog :)
      Have a nice day