Skip to main content

Application Merge Utilities - How to Use - Compare & Update NAVApplicationObject.

Hi All,

This is Fifth Post in this series. If you would like to read earlier post please visit Index of Application Merge Utilities.

As Promised In This Post we will see about Next Two Commands Available in the the Module "Microsoft.Dynamics.Nav.Model.Tools".

1. Compare-NAVApplicationObject
2. Update-NAVApplicationObject


Let's Load the Module again and see the Available Functions.
---------------------------------------------------------------------------
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\71\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -force
Get-Help "NAV"
---------------------------------------------------------------------------

For the Post i Need Two Files To Compare and a Third File to Apply the Result of Comparison.
So These are my Three Files -

I Will Compare these Two - 
NAV2013 W1 All Objects Initial Set (NO Cumulative Update).
NAV2013 W1 All Objects with Cumulative Update 17.

And Apply Change into - 
NAV2013 IN All Objects Initial Set (NO Cumulative Update).

What i want to achieve with this exercise is -
Merging of Changes From W1 Latest Cumulative Update to Indian Standard Database.

1. Compare-NAVApplicationObject =

This cmdlet will Compares text files with Microsoft Dynamics NAV application objects and then calculates the delta between the two versions. The result of the comparison is a number of text files with the calculated delta. The deltas can later be applied to a third version by using the Update-NAVApplicationObject cmdlet.

DELTA is the Difference Between Two Files. A picture might help at this moment.



Below are the files that i will use for the Demo -



This Cmdlet have Following Input Parameter 


  • Original - Specifies the application objects that are the baseline of the file comparison.
  • Modified - Specifies the application objects that you want to compare to the original version.
  • Delta - Specifies the folder where the result of the comparison between the two versions of application objects must be put. 

  • Force -Forces the cmdlet to overwrite any existing files in the Delta folder.
  • Legacy - Reduces the scope of the cmdlet. Do not set this parameter.
  • NoCodeCompression - Specifies if the files that are the result of the comparison must not be compressed.
  • PassThru - Specifies if the cmdlet must return a FileInfo object for each .delta file that is created by the comparison. If you do not set this parameter, the cmdlet returns a list of the files.

------------------------------------------------------------------------------
Compare-NAVApplicationObject -Delta C:\TEMP\Result -Modified C:\TEMP\NAV_2013_W1_With_rollup_17.txt -Original C:\TEMP\NAV_2013_W1.txt -Force -PassThru
------------------------------------------------------------------------------

Below is the Cmdlet window.


Here is the processing happing when i run the commandlet.


Here is the output of the Cmdlet -


You can open the Delta File Created as output in Notepad if you want to have a look.

Now let's see the counterpart of this Commandlet i.e Update-NAVApplicationObject .

2. Update-NAVApplicationObject  == 

This cmdlet will Applies a set of deltas to the specified application objects. The files that describe the delta are generated by the Compare-NAVApplicationObject cmdlet.

This Cmdlet have following Parameters -

  • Delta - Specifies the folder where the result of the comparison between two versions of application objects are stored.
  • Result - Specifies the folder where the updated files must be stored.
  • Target - Specifies the folder where the application objects are stored that you want to update with the delta.
  • DateTimeProperty -Specifies the value of the Date and Time properties for the updated application objects. The default value is Now.
  • DocumentationConflict - Specifies how conflicting lines in documentation triggers are merged. Set this parameter when you are merging objects with the same type of content in the documentation trigger, such as technical descriptions or a version list. The default value is ModifiedFirst.

  • Force - Forces the cmdlet to overwrite any existing files in the Result folder.
  • Legacy - Reduces the scope of the cmdlet. Do not set this parameter.
  • ModifiedProperty - Specifies the value of the Modified property for the merged application objects.
  • PassThru - Specifies if the cmdlet must return a FileInfo object for each merge operation. If you do not set this parameter, the cmdlet returns a list of the files.
  • VersionListProperty - Specifies if you want to update the Version List property for the application objects.

------------------------------------------------------------------------------
Update-NAVApplicationObject -Delta C:\TEMP\Result -Result "C:\TEMP\Final Merged Result" -Target C:\TEMP\NAV_2013_IN.txt -DateTimeProperty FromModified -DocumentationConflict ModifiedFirst -ModifiedProperty FromModified -VersionListProperty FromModified
------------------------------------------------------------------------------

Below is the Cmdlet windows of the Cmdlet.


Below is the Processing Window.



Below is the output of the Commandlet and Merged Files.


Now using the Merge-NAVApplicationObject we can merge the file and import same on NAV 2013 IN Database.


As shown in above picture the Conflicts in Text File are in Below Listed Format -

{>>>>>>>} ORIGINAL
{=======} MODIFIED
{=======} TARGET

Let's try to understand them.

{>>>>>>>} ORIGINAL = Your Base Application Code.
                                              IN MY Case its code from NAV 2013 W1

{=======} MODIFIED = Your Modified Application Code.
                                             IN MY Case its code from NAV 2013 W1 with Rollup 17.

{=======} TARGET =  Your Target Application Code.
                                          IN MY Case its code from NAV 2013 IN.

The Best part is after importing the objects in IN Database when we try to compile the objects. All Objects having Conflict in Code segment will not get compiled due to above tags. 

** BUT Remember to visit the conflict files as there might be changes related to properties or Option Strings which does not have these Tags and will get compiled without any issues. So do Visit the Conflict File.

Sample conflict (Not Identified during Compilation)-



So this is what we achieved after running the two command lets.


I would still love to use the last commandlet for Merging Gaps between Objects and same is suggested by Microsoft ins-ted of this two step procedure. We will discuss same in Next Post.

Hope some of you will be find the article useful.

Stay Tuned for More..

Regards,
Saurav Dhyani
saurav-nav.blogspot.com

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.