My first dynamic Windows Client Add-in

I have a task where a user on a Windows Client wants to use his touch screen to select from a limited set of Items.  In NAV 2009 R2 this was a form with buttons and I have been waiting to update this to NAV 2013 R2 until I had finished most of the other tasks for that client.  That time is now.

I attended the session on Directions EMEA where Vjeko presented client extensions.  I also saw a post by Rashed on his mibuso blog about buttons.

So I started the task.  I have done several add-ins for NAV so I know enough about Visual Studio to feel comfortable using it.  Of course, when ever one starts something like this there is always something new to learn and use.  To search for help on C# on the internet is really helpful and we have a lot of good examples out there.

Like Rashed, I created a panel that hosted all the buttons and text boxes and that panel is the object added to the NAV page.


I wanted to be able to customize all the buttons and text boxes from NAV so I created default values and null able values for all my properties.  Then I created a property for every value that I wanted NAV to have access to in the class.


After I created the panel control I wanted a trigger to fire in NAV to tell me that the add-in was ready.  I followed the example Vjeko gave in last Directions but that simply did not work.  I contacted him and that resulted in a new blog on Vjeko’s site.  Instead of triggering an event when creating the control the trigger is now fired after the control is bound to the NAV page.


When I get the trigger fired in NAV I create the buttons with all the properties I need.


The test page I created will allow me to select any number of buttons and/or text boxes.  I can customize background and foreground color, font family and font size.  Some of these settings can be done for each button or text box individually, that is the ones included in the arrays used when calling the CreateButtons function with arrays create from the Item table using these settings.




In the add-in I have created two event handlers to handle the push of a button or a text change.


This is handled in the NAV page with this code.


So when I press a button or change a text I will get a message from NAV.

I also made sure that if I select zero as a size for either the buttons or the text boxes they will not show.



I have adapted a new method when sharing objects and information.  I will publish on my blog how things are done if you want to create your own version and will also supply a version you can download and start using at

Objects4NAV – information and invitation


New Site for NAV Objects

Where a community of NAV professionals contribute and promote their work.

Created by a NAV MVP with the objective to setup a simple site where he could promote, sell and distribute digital content – small and large C/AL solutions packaged as objects for NAV.

It is our belief that there are many small and useful solutions out there for NAV, objects that have been developed and produced by creative Microsoft professionals. If you are interested in using this site to promote and sell your own objects, then feel free to signup here.

Objects4NAV does not take commissions or any registration fees. The site is supposed to be the mediator of information and simple catalogue of promoted products. Each contributor manages transactions and sales for their own products. The products that are there today are for example listed and sold using Sellfy.

We simply want to have a site with a simple user interface where users can find their solutions based on what it is (product tag) and what it does (post tag). Please join us to promote your work and make it easy for other NAV professionals to discover and purchase your work online.

After joining as a contributor – all you have to do to publish and promote your work on Objects4NAV is to submit product information via this form – and if you’re not giving it away, then you should also setup your product with your own account on Sellfy or some other compatible service.

We look forward to providing you this service!

Follow Objects4NAV on twitter for automatic tweets whenever a new object / product is posted on

Automatic Deployment of Microsoft .NET Framework Interoperability and Control Add-in Assemblies in NAV 2015

Sitting here at the airport in Copenhagen with my laptop waiting for my ride home to Iceland.

I wanted to write about a topic that I did not hear or see in Directions during this week.  Windows Client add-ins are now automatically downloaded from the server to the client if they are needed.

A fellow MVP Arend-Jan has already blogged about this but I want to explain a little bit more.

There are a few rules to follow to make sure that this works.  First is the assembly name.  The assembly name must be “Microsoft.Dynamics.Nav.Client.<Class Name>” if the server is supposed to find it.


Put each new assembly in a dedicated folder in the server add-ins folder.  If other components are needed for this assembly then put them in the same folder.  The server will copy the whole folder to the client.


In the Developement Environment make sure that your server is selected in Tools-Options.


Then when looking for an assembly a new option is to look in the server add-ins folder.


Adding an assembly into your code to run at the client will now work without any further actions.


And now – when I print to Excel the new Excel window opens in front of Dynamics NAV 2015.



To quote Microsoft directly:

“Automatic Deployment of Microsoft .NET Framework Interoperability and Control Add-in Assemblies

Microsoft Dynamics NAV 2015 makes it easier for the system administrators to deploy client-side assemblies for .NET Framework interoperability and client control add-ins on computers that are running the Microsoft Dynamics NAV Windows client or Microsoft Dynamics NAV Development Environment. You can now install the assemblies in the Add-ins folder on the computer that is running Microsoft Dynamics NAV Server. By default, this is the C:\Program Files\Microsoft Dynamics NAV\80\Service\Add-ins folder. When an operation from the client requires an assembly, Microsoft Dynamics NAV Server automatically deploys the assembly to a temporary folder on the client computer.

For example, if Microsoft Dynamics NAV Windows client opens a page that contains a control add-in, Microsoft Dynamics NAV Server will find the control add-in assembly by name in the Add-ins folder. Then, it deploys the assembly to the client computer in the %TEMP%\Microsoft Dynamics NAV\Add-Ins folder of user who is running the client. Subsequently, the deployed assembly will be used whenever the page is opened.

Similarly, if the development environment requires a control add-in, for example, when you compile an object, then the control add-in assembly will be deployed by the Microsoft Dynamics NAV Server to the local temporary folder for the current user on the computer that is running the development environment.

To be deployed, an assembly must comply with the following Microsoft Dynamics NAV Server configuration settings: Chuck Size, Max Upload Size, and Prohibited File Types.

If a .NET Framework interoperability or control add-in assembly is updated and its version number changes, Microsoft Dynamics NAV Server will deploy the updated assembly to the client computer the next time that the client requests the assembly. The updated assembly is put in a subfolder of the %TEMP%\Microsoft Dynamics NAV\Add-Ins folder, where the subfolder has the assembly’s version number as its name. This implementation means that you do have to remove the older versions of assemblies that are stored on the client computer.

To support compatibility with earlier version of Microsoft Dynamics NAV, before Microsoft Dynamics NAV Server deploys an assembly to a client, the client looks for the assembly in the local Add-ins folder (for example, C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins). If the assembly is not found, then the client will request the assembly from Microsoft Dynamics NAV Server. Javascript-based client add-ins have been using this deployment technique since Microsoft Dynamics NAV 2013 R2.”

Directions EMEA recap

I am now sitting in my hotel room looking back on the last three days.

Directions was packed with interesting material but what I came away with is the communication I had with other attendees, speakers, Microsoft employees and last but not least my fellow NAV MVPs.

Most of the NAV MVPs present got a change to sit down and speak together about how we can increase our support to NAV partners and to the community.  This was a good meeting and I am hopeful that this will lead to good things in the close future.

I would like to thank the Directions EMEA committee for a great conference and all the people who made my stay in Poznan a memorable time.

Next is NAVTechDays in Antwerp.  See you there.

Ping your web service for security

Increasingly we are using Web Services to communicate between NAV companies.  In a production environment these communication is usually secured by the SSL standard. When the communication is sent over the Internet I would recommend that a secure ping be added before every communication to make sure that the correct machines are speaking together.

The payment service module in NAV 2013 R2 has an encryption functionality.  I am using this functionality every time that I store user names and passwords in the database. This encryption functionality is based on the key located in the Online Service add-in folder.


You can copy the Providerkey.key file from one server to another or use the Payment Service Connection Setup page to upload, download, delete and to create a new key.


Create a function and add to you web service.



The encrypted string is then decrypted and compared with the original string sent.


The EncryptionMgt refers to Codeunit 824.  A possibility to add the secret as a parameter to every web service call and skip the preceding ping function.  The code examples can be downloaded from Objects4NAV.


Another year as a Dynamics NAV MVP


Dear Gunnar Gestsson,

Congratulations! We are pleased to present you with the 2014 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in Dynamics NAV technical communities during the past year.

Thanks to Microsoft for this honor.  I will continue to do everything that I can to make sure that Dynamics NAV continues to be a great product and to make sure that more and more users and developers will have a better experience with the product.