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 = 1.0.0.0

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 1.0.0.0) -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.

SKYDRIVE LINK

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.

Regards,
Saurav Dhyani

Comments

Popular posts from this blog

BC 21 and Higher - PowerShell Cmdlet (Replacement of Business Central Administration).

Hi Readers, As discussed in last article about deprecating of Business Central Administration, there are few common actions that we use in administration till Business Central 20. For our on-prem customers, we will still require doing activities. As Microsoft suggest we need to start using PowerShell cmdlet.    Let's see how to do those via PowerShell, or Administration Shell. I will be keep adding commands as you comment to this article.

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 - 

MSDYN365BC - Data Upgrade To Microsoft Dynamics 365 Business Central on premises.

Hi Readers, We have already talked about the number of steps for upgrading to Business Central on Premises from different NAV versions. After that article, I received multiple requests for an article which list down steps for Data Migration. In this article, we will discuss steps of data migration to MSDYN365BC (on-Prem) from NAV 2017. For this article, I am considering a Cronus Demo Database without any customization. For an actual upgrade project, we will have to complete object merge using compare and Merge process. After the Merge Process, the next step is data migration. Let's discuss those steps. Direct Upgrade to Microsoft Dynamics 365 Business Central (on-Prem) is from following versions - 1. NAV 2015. 2. NAV 2016. 3. NAV 2017. 4. NAV 2018.