«

»

Print this Post

Powershell: The Merge-commandlets for NAV 2013

5.00 avg. rating (98% score) - 4 votes

I have been looking forward to blog about this, since I have been testing and working with these commandlets for quite some time now. With the release of Cumulative Update 9, these commandlets are being released .. so FINALLY I’m able to blog about it.

But I’m not gonna .. at least, I’m not going to do an introduction about it, just because Soren Klemmensen beat me to it :-). He wrote a perfect introduction (may be it’s already quite more then only an intro..) on his blog in the post “Merging Application Objects with PowerShell in Cumulative Update 9 for Microsoft Dynamics NAV 2013 R2“. I would be an idiot to write about the same, while the only right thing to do is just to thank Soren, and point to his blog. Thanks Soren! :-).

Let’s just sum up the new commandlets that are available for you:

  • Split-NAVApplicationObjectFile: This is going to split up the text files into separate files
  • Join-NAVApplicationObjectFile: This is going to join separate test files into one file for easier import
  • Compare-NAVApplicationObject: This is going to compare 2 sets of textfiles, and will create delta files (extension: .DELTA) that sums up all the differences between the corresponding textfiles. Note: it’s going to compare NAV Objects, so you can’t use this to compare your thesis or whatever ;-).
  • Update-NAVApplicationObject: This commandlet can apply delta-files to a set of object-textfiles.. .
  • Merge-NAVApplicationObject: the merge-commandlet is the one you will love the most, but is actualy only a combination of the compare and the update-commandlet: it will take the three versions, and spit out a fourth, merge, version. Obviously, you are going to have conflicts, which this commandlet will export extra textfiles for (extension: .CONFLICT), and have inline added lines to mark the conflicts in the merged textfile.
  • Get-NAVApplicationObjectProperty: To get object properties, like Date, Time, VersionList and Modified.
  • Set-NAVApplicationObjectProperty: to actually CHANGE the properties…

I have been testing deeply with these commandlets .. Have written quite some scripts that is going to automate a lot for me. You can see that this testing also made me creating the scripts for import/exporting object textfiles in powershell, which you can find here:

I especially like the import-statement together with the merge-commandlets/scripts. I don’t like to join the files and try importing them. When you do it with the script, it is slower (I admit), but it imports what it can import, and it gives you a list of errored files which – for some reason or another (look at the log) – are not able to import. The one big textfile is only going to error out on the first error, and leave you with nothing. Usually, it’s ControlID’s that causes files not able to import .. and as far as I know, in the future .. Microsoft is going to foresee a solution for this as well (it’s under investigation ;-)). As if there is one thing that I noticed during this beta-phase .. Microsoft REALLY listens to the input of the testers.. .

One last thing I’d like to add: it’s bloody fast! It handles the files so fast .. Beautiful! I’m thrilled for this new addition .. I’m incorperating it to do the monthly updates with my eyes closed .. and I’m succeeding thanks to how these commandlets were made, how they are working, and how they perform.

Lots of blogposts to follow with tips and tricks, while the best tip I can give is: try it, test it, do it yourself .. and in no time, you can’t live without it anymore!

You can’t work with Powershell? Well, time for some advertisement then ;-). I created 2 movies, and will do a workshop on NAVTechDays. Here is more information:

Oh yeah .. almost forgot .. we implemented the hooks pattern quite extensively at my company. Well .. I can tell you this: using these commandlets, I’m upgrading to NAV Crete in a matter of minutes: I only have to solve about 20 conflict-files, which usually are just placing the hook at the end of the trigger that also Microsoft added code to.. and that’s it! I’m so happy ;-)!

Permanent link to this article: http://www.waldo.be/2014/07/10/powershell-the-merge-commandlets-for-nav-2013/

3 comments

8 pings

Skip to comment form

  1. Soren Klemmensen

    You are welcome and thanks for the kind words.

  2. Thomas Dobrowolski

    Could you compare Microsoft’s Merge-Command with a normal merge tool like Kdiff or Araxis? Does the MS command consider the structure of a NAV code .txt-file or does it a simple text merge?
    I’m currently using git for merges, but it’s merge is just a textfile merge, which sometimes might result in strange behaviors.

    1. waldo

      In many cases, it’s a normal text-compare (like code), but there are cases it’s going to consider NAV-context, like fields, variables, and such. So, adding fields on the same place doesn’t necessarily end up in a conflict, while in normal text-compare, it would.

      Hope that makes any sense? :-)

  1. New Developer Tools for Dynamics NAV 2013 R2 | Gunnar's Blog

    […] You can read about these tools in the NAV Team Blog, on Soren’s Blog and on Waldo’s Blog. […]

  2. Microsoft Dynamics NAV 2015 is announced! » waldo's blog

    […] upgrade tools: part of the tools have been released with CU9. Those commandlets are soooo freaking cool. But the other part: to do the data-upgrade .. will be […]

  3. Microsoft Dynamics NAV 2015 is announced! - Microsoft Dynamics NAV Community

    […] upgrade tools: part of the tools have been released with CU9. Those commandlets are soooo freaking cool. But the other part: to do the data-upgrade .. will be […]

  4. Tax Updates Dependent on Cumulative Updates (CU) for NAV 2013 and higher » waldo's blog

    […] The new Merge-commandlets are going to be very useful for this. Only thing is .. You’ll have to work on your development guidelines and products that way, that it’s “always” easy to merge the new updates into you product/customerdb’s. Internally we have done this the past year-and-a-half .. with succes. An CU only costs us about 15 minutes of real merge-work .. the rest is automated.. . […]

  5. PowerShell Script to Merge NAV Versionlist » waldo's blog

    […] might have visited one of the session about the great new addition in NAV2015 (in fact, already in NAV2013 R2 CU9): the new PowerShell commandlets to merge Microsoft Dynamics NAV objects .. or its official name: […]

  6. PowerShell Script to Merge NAV Versionlist - Microsoft Dynamics NAV Community

    […] might have visited one of the session about the great new addition in NAV2015 (in fact, already in NAV2013 R2 CU9): the new PowerShell commandlets to merge Microsoft Dynamics NAV objects .. or its official name: […]

Leave a Reply

%d bloggers like this: