Thursday, 30 August 2007
Dataports are Dynamics NAV's object for importing and exporting data. The dataport looks a bit like a report when the user launches it with some options to specify field filters and an Options tab for selecting Import/Export and for picking the file name to be used.
For my dataport, I wanted to provide the user with a couple of fields to pick the Gen. Journal Template Name and Gen. Journal Batch Name that the journal lines are to be inserted into. When I added a field to the Request Form, the standard Import/Export radio buttons and the File name field dissappear.
In this post, I'll tell you about a couple of tricks that will help you to put these fields back on the request form and also how to put lookups on the journal fields. I wanted my dataport to look like this:
As you can see, I have the usual File Name and Direction radio buttons and have my two new fields with lookup buttons for the user to select the correct value.
So let's start with the File Name field. Create a global variable of Text 1024 and use this as the Source Expression property for a new text box on the request form. Now here's the trick. If you want the file requester dialogue box to appear without any programming needed, simply make sure the control has an ID of 1. That's it! Thanks to a work colleague for that, I never would have guessed and I thought I was facing a lot of coding around the common dialogue requester.
Next challenge for me was the direction radio buttons. Not being an experienced NAV programmer, I thought that these would use a Boolean control as a Source expression. I tried this and I could not get the buttons to click, no matter what code I added. One of the postings on Dynamics User pointed me to using an Option type field. I created a new global variable as an option string with choices of Import and Export. I then assigned the variable to both of the radio buttons but specified the Import option as the Option property for the top one and Export option as the the Option property for the bottom one. How easy was that?
Now on to the look-up buttons and pick lists. The Journal Template was easy, I just set the TableRelation property on the field to be "Gen. Journal Template". The next bit was a little harder. I wanted the journal batch look-up to only show batches that belong to the journal template I had already selected.
To start, I looked at the G/L Journal form as I knew that this had a batch name field that provided a lookup that worked in the way I wanted. I saw that the field was using a LookupName function in codeunit 230. I put in some code in the OnLookup trigger for the field (after setting the Lookup property to Yes of course) as follows:
GenJournalLine.SETFILTER("Journal Template Name", GenJournalLine."Journal Template Name");
On this line, GenJnlManagement is my variable of type codeunit (230), GenJnlBatch is my variable of code 10 which is storing my batch name and GenJournalLine is a record type variable of type Gen. Journal Line (that is required by the function.) The filter, I figured would provide the magic of only showing the batch names for the correct template.
When I called this function, I got an error saying that I needed to set a filter on the Batch Name field. This seemed a bit weird to me since I was trying to lookup the field, so why would I be filtering on it?
I then figured that maybe NAV wanted to know where to put the cursor when it displays the lookup form so I added this line before the call to the codeunit function.
GenJournalLine.SETFILTER("Journal Batch Name", '-');
This line tells NAV to find the first Batch Name that matches the filters I have set on my record handle.
All was sweet! A few little error checks and validations and I was in business. Hopefully, if someone has the same issues and searches for "How to use Radio Buttons in a Request Form" or "Filter must be set before calling LookUpName name function" they will find this post and get a nice shortcut.
Thursday, 9 August 2007
The presentation from Convergence 2007 gave me my first real look at Dynamics NAV 5.1. Following on from my previous post on the Role-tailored User Experience, here are some details on the use of Reporting Services and exposing NAV logic as Web Services.
Reports in Dynamics NAV 5.1 utilise Microsoft SQL Server Reporting Services. This, we are told, allows:
- Richer visual effects
- Interactive reports
- Export to Excel, PDF on all reports
The transformation tool will (hopefully) create the report for you but you may need to translate some of the code by hand. You will then have the option of adding in your own SSRS specific elements such as interactive elements, dynamic sorting and graphs.
The Development environment in the demonstration still resides in the Dynamics NAV "classic" client but hopefully this will be sorted out before the release (they certainly have plenty of time.)
I am guessing the report dialogue box is going to get a face-lift as the version I saw did not look that great. First of all you get a filtering dialogue box which looks like the Filter pane on the List Place and when you accept the filter, you get a sorting dialogue. I am guessing that if a request form was used, this would have popped up somewhere as well.
Jesper opens the report for editing in the normal way and then, from the Tools menu, selects an option to Transform the Layout (there is another option to Transform the Request Form.) Selecting this option opens a Microsoft Visual Studio window with a Report.rdlc in design mode. I have been using Reporting Services for a good number of years but I wasn't familiar with this rdlc file extension. It turns out that Microsoft added the capability to host reporting services reports in .NET applications using client report definition supported in .NET 2.0. I don't know much about this but you can find out more on msdn.
This little part of the demo has answered the question for me as to how the team are intending to use Reporting Services within the Dynamics NAV application and I think they are being very clever. By using this approach they are giving the users some of the power of reporting services but still keeping control of the reports within the application. This does mean that you will still need a NAV license to view the reports but I am guessing they will make a MOSS-based report viewer.
In addition to the .rdlc file there is a .xsd file (not sure of the purpose of this but it could be a definition of the dataset.) The report has Website Data Source with a Dataset and ResultSet. The information in the report is based on the dataset that is already defined in the report (no hacking SQL here.) It looks like the dataset contains all of the fields from all of the tables within scope plus the values of variables in a single dataset.
Jesper closes Visual studio and returns to NAV and the designer detects that the rdlc file has been changed and asks if you want to load it against the report definition. The whole process certainly seemed quite painless. I would be interested to see if you can use custom assemblies in reports (such as a barcode renderer or other custom graphics renderer.) From the article on msdn it appears that this is supported in rdlc but I am not sure if the NAV application will allow it.
I have to say I found the reports section very impressive and from what I have read, it will be possible to schedule the reports and distribute them using the NAV application so the lack of Report Server hosting is not such a drawback.
This section was presented by Kris Rafnsson.
This is where the NAV team have really stuck to that core value of simplicity. Take the page or codeunit you wish to expose as a web service and add them to a new Web Service table in NAV. Give the service a name and tick the Published check box. You now have a web service. How cool is that? Thankfully the demonstration then goes on to show a couple of uses of the new web service.
The first example shows how you can build a simple application in InfoPath that allows you to query NAV customers in less than 5 minutes – without writing a single line of code!
The URL for the web service in the demo is port 3000 on the machine running the service tier followed by WebServices, the company name, Page (presumably code unit would say Codeunit here) then the name that you gave the service followed by a navws extension.
The methods that are available after adding the page as a web service are:
I am not sure what happens to any custom functions that may also be on the page.
The filter that is exposed allows filtering on any field – just as you would in the full user experience. All of the fields from the table are returned as data. Once Kris ran the form, he was able to pull back data for all customers matching a given filter. It was a nearly trivial example but impressive nonetheless. I would have loved to have seen him use the view and update option to post changes back to NAV – I can only assume that this still needs some work.
SharePoint Server 2007 (MOSS) allows the web services to be consumed from NAV in a similar way without writing any code. In the second example Kris creates a Business Data Catalogue Application (he used a pre-prepared XML file for the demo but said that there will be some tools to help build these xml files hopefully ready prior to the release) to use with the NAV web service.
After importing the application definition, there is an entity available called Customer_Service – I am guessing this can be named in the xml file. He then creates a site and page as normal in SharePoint but selects the option for a Business Data List (a part that displays a list of items from a data source in the Business Data Catalogue.) He then links up the Business Data List to the newly created Business Data Catalogue Application.
When the new page is run, there is an actions drop down button and a nice interface for specifying any number of field filters. He hits the Retrieve Data button and the list of data comes back. He clicked on the No. field for the customer and a new Details form is displayed showing all fields that customer.
What he showed is a SharePoint hosted NAV form with no coding and none of the configuration that is needed for the Employee Portal application. From the looks of things the security and different options that you would have in the Employee Portal are taken care of at the SharePoint end when defining the Business Data Catalogue Application. I was very impressed by this and it looked a lot more polished than the current Employee Portal offering.
Some ideas for how the web services could be used are given by Jesper as:
- Master Data Management
- Maintaining Exchange Rates
- Integration with other Applications
- Specialised Clients
- Mobile scenarios
This really is exciting stuff. Come on Microsoft – let's have more of this! Let's have an opportunity to learn about this great technology you are building and maybe make some suggestions along the way.
Wednesday, 8 August 2007
This presentation from Convergence 2007 gave me my first real look at Dynamics NAV 5.1. Jesper Lachance Ræbild and Frank Fugl do a great job and if you are interested in the next release of Dynamics NAV, I recommend you take 50 minutes to watch the presentation.
The Dynamics NAV 5.1 release is all about adding cutting-edge technology on top of the rich functionality provided in the 5.0 release. Jesper says that there is no new application functionality in 5.1 compared to 5.0 (although there has been mention of RFID support in other material.) The message to companies wanting this new technology is to upgrade to NAV 5.0 now in preparation for 5.1.
Dynamics NAV 5.1 will provide:
- A Role-tailored User Experience
- Web Services
- A 3-tier Architecture
- .NET Compliance
The way the Dynamics NAV team have delivered the technology has kept to NAV's core values of simplicity, flexibility and ease of use.
The new architecture will use the same application logic, the same office integration, and the same outlook integration as we currently have in version 5.0 so you will be wise to spend your time learning these new features and understanding the application enhancements.
Jesper tells us that the new architecture is meta-data based, and to go from NAV 5.0 to 5.1 you will need to use a transformation process to create the new pages and reports. Microsoft will deliver transformation tools that will take the application and forms and transform them into the new technology. There may be some manual intervention required, but the tools should take you most of the way.
Role-tailored User Experience
Role centre is the new term for the home page that is configured to meet the requirements of the user. The main screen comprises a Navigation Pane and an Activities Pane (tailored to the role being played by the user.) Jesper makes an analogy to a car that remembers your preferences for seat, steering wheel, and mirror positions in order to meet your driving needs. A number of roles from the Dynamics customer model will be delivered in conjunction with tools to allow new roles to be created.
Selecting options from the Navigation Pane takes the user straight into a list view which Jesper called a "List Place" (rather than the card form used in earlier versions.) Apparently, research has shown that in previous versions people would open the menu option and then immediately launch the list from the card in order to be able to search.
When looking at the Sales Order List Place, we see Actions, Related Information and Reports drop down menus. Linked to the list are fact boxes that update relative to the selected record and can show details such as Customer Statistics, Customer Details and Notes.
The main window has an address bar that can be used to navigate in a similar way to breadcrumbs on a web site. There are browser-style forward and back buttons allowing you to easily go back to your previous location (a feature that I think will prove very popular.) Microsoft has clearly put a lot of thought into the new user experience and their efforts appear to have paid off.
The pages can be personalised by the individual users but can also be configured by a systems administrator and distributed out to the users or groups of users.
The character of NAV has remained and I think existing users will adapt easily to the new features. A good example of this is the way record filtering has been implemented. The principal is the same as the old-style record filters but the use of a nice Filter Pane, a new layout and some extra text and buttons helps to make the filtering process more intuitive. Including a few English words such as "Show Results", "Where" the field name "is" made me realise how alien the old filtering form really was. It is good to see that the team have kept the powerful expressions that are used to denote ranges, relative and logical selections. I would like to see a more graphical filtering pane similar to those found in CRM 3.0 or SQL 2005 Report Builder but maybe this will come with time.
The list can be opened in a new window by selecting an option from the Action menu or by using a key-combination. This gives a similar experience to opening folders in a new window from within Outlook. It appears that the design team have used Outlook as their inspiration for how an application should present information and options to the user. The team have done well and the demonstration certainly showed a system that is likely to be well received.
There are many customisation options that should meet the needs of most users. Some of the new features are quite exciting such as the Freeze Pane–a really useful feature similar to the Freeze Panes option in Excel that allows you to lock columns on the left hand side when scrolling horizontally. It reminded me a little of the old Matrix form control but obviously it is showing fields form a single data set and not a cross-tab.
Double-clicking a record in the list place mirrors the Outlook paradigm well and behaves similarly to the process of opening an e-mail from your inbox in Outlook. The details for the record open in a new window called a Task Page. This is similar to the CRM 3.0 experience and I know that some users may not like this. I like it but it does lead to quite a few windows being opened.
The tabbed-form control has been replaced with new Fast Tabs that allow more than one tab to be open at any time with the ability to promote certain fields to be displayed on the "tab band" (my term not their's) when minimised.
The customisation of the task pages allows the fast tabs to be removed from the display or customised to a field level. Each field can now have different levels of importance Standard, Promoted and Additional. A promoted field will be displayed on the fast tab band so that it is visible without needing to open the tab. The additional fields will be temporarily hidden until the user clicks on a control to reveal the additional information. I really like this and it shows a lot of thought from the design team.
It appears that the old drop-down and look-up buttons have been replaced with a single combo-box-style control which makes a lot more sense. I have not seen any evidence of what happens to assist-edit buttons and drill-down fields. The phrase Jesper used was "taking away the clutter" – something I know a lot of users will applaud.
The action pane is similar to the ribbon in Office 2007 although it does not behave exactly the same. I prefer the Office 2007 ribbon. You can think of the Action Pane as a way of promoting common actions from the Actions menu for quick access (you can also increase the size of actions on the Pane which makes them larger and therefore more easily accessible.) Jesper says they have taken "elements of the Office 2007 user experience and added them into Dynamics NAV."
The export to office using XSLT stylesheets works in the same way as NAV 5.0 so the old stylesheets can still be used.
In my next posting, I'll discuss the presentation of the new reporting environment and the use of Web Services.
Tuesday, 7 August 2007
Not only does Dynamics NAV 5.1 appear to not suck at all. It appears that it is going to be pretty mind-blowing. The Development Team have really pulled one out of the hat with this one and if we need to wait a while to get it stable then so be it.
So what changed my mind? I have just watched a demo (which you can download from MIBUSO) and the way they have tackled the architecture is simply superb. The demo of creating an InfoPath form that consumes a Dynamics NAV Page as a webservice is pretty stunning. Stunning in how simple it is!
I am so excited, I think I'm going to watch it again. My precious!