So having created the simple objects for our Fuel recording application previously (link here) we now need to ensure that we create some new page objects (which can later be exposed as web services) related to the forms we have already created.
As you probably know by now, there are at least 3 ways to achieve this task:
Being NAV developers, we may think that the most straightforward way to create pages would be to go to our trusty object designer and create the new page objects directly. Although this does away with the anticipated fiddling with other tools and processes, this is not as simple as one would hope. Effectively this boils down to something which resembles editing XML from within NAV – OK it looks slightly simpler, but with the vast arrays of properties and attributes hanging off of every line type this could be a time consuming process. This is also coupled with the fact that there is no simple way to visualise the fruits of our labour. So I am going to reserve the use of the page designer in NAV for those instances when we need to manually manipulate and tweak the results of the other methods of page creation.
Instead I am going to go first for basic process – export as XML, transform and then re-import the results.
As mentioned previously I have three basic forms:
These fields are populated by validation when we enter the fuel entry records.
So let's go for it... first export the 3 forms as XML. Be sure to call this Forms.xml so that the Transformation Tool will recognise it. Run the transformation tool itself: Microsoft.Dynamics.Nav.Tools.FormTransformation and voila we should now have a new XML file called "Pages.xml" in the transformation folder.
Now let's the results. Import the Pages.xml file into the database, navigate to them (they should have names and object IDs equivalent to those of the forms), and compile them. To run the new pages without having to add the relevant links etc to existing RTC pages, simply run them from the command prompt: C:\Program Files\Microsoft Dynamics NAV\60\RoleTailored Client\Microsoft.Dynamics.Nav.Client.exe DynamicsNAV:////runpage?Page=xxxxx
So as you can see a couple of pages have been rendered. They are not the prettiest of pages, but they have been created with very little effort.
Next time (hopefully very soon ) we will look at using the TIF Editor to manipulate our pages more during the transformation process before we move on to the web services themself.