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:
- How Do I: Get started with PowerShell for Microsoft Dynamics NAV 2013 R2
- How Do I: Create PowerShell scripts for Microsoft Dynamics NAV 2013 R2
- The workshop on NAVTechDays (Working with Powershell and Microsoft Dynamics NAV)
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 ;-)!
You are welcome and thanks for the kind words.
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.
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? 🙂