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.
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)