Implementing a Simple Extensibility Control in Dynamics NAV 2009


Control add-ins are a handy way to extend the functionality of an ERP system. The release of Dynamics NAV 2009 SP1 made developing Role-Tailored client add-ins possible due to the introduction of a client extensibility API. This API uses .NET library resources to connect data with Dynamics NAV.

In this demo we are going to have a look at a simple example of extensibility, a Label control attached to the Notes multiline textbox. The extensible feature that we are going to implement is a font type. Knowing that Dynamics NAV only supports a limited number of fonts, we are going to assign a non-standard font type to our label.

To create our add-in, we are going to use Visual Studio 2008 and to implement the add-in we will use Dynamics NAV 2013 R2 version.

We will be creating the add-in in the following steps:

  1. Creating the Class project
  2. Signing the Assembly
  3. Registering the add-in in Dynamics NAV
  4. Creating a page to view the add-ins


  1. Open Microsoft Visual Studio and create a New Project of Class Library type. Name it as LabelDemo:

  2. In the Solution Explorer window, we would need to expand the References and add the Microsoft.Dynamics.Framework.UI.Extensibility assembly to our project. This is needed to provide use of the extensibility API to Dynamics NAV. Right-click on the References node and select the extensibility .dll located in the NAV RoleTailored Client installation folder. Click OK to add the assembly. In the same way, add the System.Windows.Forms and System.Drawing references under the .NET tab:

  3. Now, in the class code section, we will create the necessary functionality for our add-in. First we will add the namespaces related to Dynamics NAV extensibility support. This is required so that we can use the extensibility methods located in this library. Add the following code to the top class code section. The first two lines are referencing the Dynamics NAV extensibility library, the second two lines are needed to display the form controls and manage their properties:

  4. Next, rename a namespace to NAVDemo to make it more meaningful. Within this namespace, we will add the ControlAddInExport attribute with the name of the add-in. This name will be later used to register the add-in within Dynamics NAV

  5. Within the namespace, create a public class NAVLabelDemo as shown on the screenshot. Within this class we will have two methods, the CreateControl method defining the label and its behavior, and the OnTextBoxClick method which will call the Dynamics NAV OnControlAddIn trigger:

  6. Within the CreateControl method, add the following code. This code creates a label ‘Reference Notes’, assigns the background color, size and a custom font. On clicking the label, the OnTextboxClick method will be raised which interacts with the Dynamics NAV OnControlAddin trigger:

  7. Within the OnTextboxClick method, add the following code to make our add-in interact with NAV:

  8. In the Visual Studio menu, click Build, Build Solution (alternatively, hit F6). Make sure the build succeeded, if it did we are ready to sing the assembly and make it available. Click Project, Properties:

  9. On the Signing tab, select the Sign the assembly checkbox and select New in the Strong Name Key file:

  10. Add the Key file name, uncheck the password protect option and click OK:

  11. On the Build Events tab, enter the following in the Post-build event command line section:

    “C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\sn.exe” -T $(TargetPath):

    This will call the .NET tool which will make a public key token available for us to copy and use while registering our add-in in Dynamics NAV

  12. In the Visual Studio menu, click Build, Rebuild Solution. Then click View, Output. This will display the key token:

  13. Navigate to the project solution folder. In our case this is C:\Projects\LabelDemo\LabelDemo\bin\Debug. There, locate the LabelDemo.dll file and copy it to the following Dynamics NAV folder: C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client\Add-ins

  14. Open the Dynamics NAV Role-Tailored client and in the search window, find the Control Add-Ins page. Click Edit List:

  15. Enter the following on the new line and click OK. Now the add-in is registered within Dynamics NAV. Next, we will create a page to display the add-in:

  16. Open Dynamics NAV Development Environment. In the Object Designer, select Pages and click New to add a new page object. Add the following lines to the structure:

  17. Next, add two fields within the group, the first one being our add-in. To show that this is an add-in, click Shift+F4 to open the Properties window for the field. Set the properties for the field as shown:

  18. Click View, C/AL Globals and add a new variable notes of type Text

  19. Add the second field called Notes to our page. Set the SourceExpression property to the notes variable added previously. Set the field property ShowCaption to No and MultiLine to Yes. Save and close the page.
  20. Now, if we run the page, the add-in is displayed:


It shows the colored label with custom Broadway font.

This is just a simple example to demonstrate the possibilities of extensibility features and how the RoleTailored client control add-ins add custom functionality to pages. Control add-ins are included in the Dynamics NAV installation package as Microsoft .NET Framework–based assemblies which makes them easy to integrate into your projects.


Email [email protected] with any questions you have pertaining to this course.

New CPE Accredited Courses Now Available for Dynamics AX, GP, and NAVEARN CREDITS TODAY