Skip to main content

Microsoft Dynamics NAV 2016 Extensions - Develop Extension Part 2.

Hi All,

Let's start it from where we left in Last Post.

Recap - "We understand Concept of Extension Using an Example of Shipping of Jet Report Solutions. Later We did a customization on a Standard NAV 2016 W1 Database For Cancel Order Using Events."

If you are not following the Extension Series Then Refer the Table of Contents For Extensions.

If you Don't Know How Events Works Refer The Table of Contents for Events & Subscriptions.

Pre-Requisites - Create a Folder in C Drive Named - Extensions

In This Article Series We will see How to Create Extension for the Customization That we Did in Extension_Demo1 Database.

Let's Start -
1. Export Selected (Customized) Objects as txt (File Name - Custom.txt) from Extension_Demo1 Database, using below filters in Folder (C:\Extensions\).

Tables - 38|91|312|5109
Pages - 50|119|460|5167|9307
Codeunit - 70000

2. If you remember I Told you to Create a Seprate W1 Database Named Extension_Demo2. Export the Objects from this database (File Name - Base.txt) using same filters as above  in Folder (C:\Extensions\).

3. Create a Folder inside Extension Folder Called Delta as shown Below.

4. Open PowerShell ISE as Administrator. 
File Location - C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
IF you don't know how to open Powershell Then Refer Here.

5. IF you are a regular reader of blog you would remember that we discussed Application Merge Utilities (AMU) Released with Microsoft Dynamics NAV 2013 R2 CU8.

We will be using One of the AMU cmdlets, that is Compare-NAVApplicationObject .

For Detailed Explanation of Compare cmdlet Refer Here.

6. A Compare cmdlet compare two text files and Provides us a Set of Delta Files, which is difference between two compared files.

7. Now In Powershell, Set Execution Policy & then Load Cmdlet for Navision by Running cmdlet shown below -
Set-ExecutionPolicy RemoteSigned
Import-Module 'C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client\NavModelTools.ps1'

8. Once cmdlet Load Module for Navision, Run the Compare-NAVApplicationObject Cmdlet as shown Below -
Compare-NAVApplicationObject -DeltaPath C:\Extensions\Delta -ModifiedPath C:\Extensions\Custom.txt -OriginalPath C:\Extensions\Base.txt

9. Run the cmdlet, The Delta Files will be created under Delta Folder as shown below.
** Delta is Actually What we Customize on Top of Base Microsoft Object Set.

10. Delta is Something that we want to pack as Exe and share with our customers To install on there Navision Base Installation.

11. Next Task is to create a Manifest File.
A Manifest file, is a Xml File which contain the details about Package, in same way Like we have Metadata for All objects in Navision.

12. There are Two Steps in Creating a Manifest file -
 > Create a Manifest File.
 > Save the Manifest File.

13. Search for Cmdlet - New-NAVAppManifest, Fill in Details as Below - But Don't Run the Cmdlet.
Name = CancelOrder
Publisher = SauravNav
Description = App To Cancel Purchase Orders
Prerequisites = CodeUnit=1
Version =

Dont Run...
** Publisher can be the Your Company Name.
** Version Should Follow the Same 4 Digits separate by Dots.
** Prerequisites can be multiple using comma separated string, Suppose you want a extension for only India location then you can have an object in Prerequisites which contain version tag as NAVIN only.
** Prerequisites are Case Sensitive.

Copy the Cmdlet as shown below -

14. Now Search for Cmdlet - New-NAVAppManifestFile and In Manifest parameter paste what you copied on Last Step as below -
New-NAVAppManifestFile -Manifest (New-NAVAppManifest -Name CancelOrder -Publisher SauravNav -Description "App To Cancel Purchase Orders" -Prerequisites CodeUnit=1 -Version -Path "C:\Extensions\CancelOrder.xml"

Run the Cmdlet from the window as shown below -

15. Output will be a xml File Created in C:\Extensions as shown below.

16. Next is to Create the Navx Package for Our Extension. A Navx Package is Always created Based on a Manifest File,so remember to Keep the file safe for future use also. ... (last Step for Today's Article)

17. This is again a Two Step Process -
  > Get the Information of Manifest File.
  > Create Navx Package Using Information in Manifest File.

18. Search for Cmdlet - Get-NAVAppManifest. This Cmdlet Provides you details of the Manifest file which we saw in Picture above.
 > Path - C:\Extensions\CancelOrder.xml

** Copy the cmdlet as you did in last example.

19. Serach for Cmdlet - New-NavAppPackage and assign Parameters as Below -
Manifest = Get-NAVAppManifest -Path C:\Extensions\CancelOrder.xml
Path = C:\Extensions\CancelOrder.navx
SourcePath - C:\Extensions\Delta\
New-NAVAppPackage -Manifest (Get-NAVAppManifest -Path C:\Extensions\CancelOrder.xml) -Path C:\Extensions\CancelOrder.navx -SourcePath C:\Extensions\Delta\

18. The Output will be a Navx File as shown Below.

Now Our Package (Exe) is Ready, We can ship it to customer.

In Next Article in this series we will see How we can Publish & Install an Extension Package on customer Environment.

You can download the cmdlets & Other Files from My Skydrive Folder.


File Name - Microsoft Dynamics NAV 2016 - Extensions Demo (Part 2 Objects)

** Remember you can run these cmdlets without any change if you are following the Folder structure and File Name as discussed in the Series of the article.

Hope you like the article. Please feel free to put your views as comments to article.

Saurav Dhyani


Popular posts from this blog

Send Mail with Attachment From Navision.

Hi all, We have seen how to save a report into PDF and how to send mail to a customer. Let's link these two post in one i.e. Mailing statement to a customer into PDF Format. This article is part of the Series. Please Refer  Table of Content here . If you have the old objects set let me brief you what I will be changing - 

Dynamics 365 Business Central 2021 release wave 2 (BC19) Released.

Hi Readers, As we all were expecting Microsoft have Released Business Central 2021 Release Wave 2 Today a.k.a BC19. In this article we will see what all is announced with the General Availability.  Starting Today Customers & Partners can start using Business Central 19. #msdyn365bc #bc19

Error After Restore SQL Backup of NAV 2013 Database

Hi all, we are facing a conman issue during restoring a SQL Database backup restored for NAV 2013. While Trying to run object from Object Designer we get below listed error (even the service is configured properly) - --------------------------- Microsoft Dynamics NAV Development Environment --------------------------- There are no NAV Server instances available for this database. You must ensure that a NAV Server instance is running and is configured to use the database before you perform this activity. --------------------------- OK    ---------------------------