If you are a NAV developer, you probably have heard about the upcoming “New Developer Tools”. And if you didn’t, it’s very much time for you to catch up with the readings about this, like:
And when you read this blog from Freddy – you might as well got started in Extensionsv1, and wonder how you can convert all your work to Extensionv2 – or basically – from C/AL to AL.
Well, the latest update of the NAV Developer Preview has been released (you should read all about it here), and along with that release, we got the very first version of what is going to be the “converter” – the tool that will convert exported txt-files to .al-files.
I was hoping for a simple extra PowerShell CmdLet, part of the “Microsoft.Dynamics.Nav.Model.Tools” module – or any other. But no .. no PowerShell.
And while some might still think that “PowerShell” is a “step back” – well – for this tool, we actually need to take a step back. This tool has to be executed in .. uhm .. are you sitting down? .. If not .. brace yourself .. In order to use this tool .. we need to use .. the command line.
I actually refuse to take that step back. If you know me a little – I’ll try to make it easy on myself – and make it part of my toolset that I’m comfortable using.
And I really didn’t want to put too much time in it – so I only created a draft version – which tend to work quite well (the reason is that I do expect Microsoft to come up with a PowerShell version of this tool as well).
I remembered that back in version 2013, when we didn’t have the out-of-the-box function “Export-NAVApplicationObject”, that I created some functions in PowerShell to do just that. It was basically a wrapper around the existing command line option to export objects, using the finsql.
I decided to copy most of that business logic into a new function, and extend it with also calling the new txt2al.exe (which you can find also in the “RoleTailored Client” folder – at least in the current TENERIFE version). The end-result is a somewhat-messy-but-it-does-the-trick-function that I decided to call “Export-NAVALfromNAVApplicationObject“. You can find it on my github.
And this is basically how it works:
And here is how you can use it…
Just try for yourself .. here is an example which you can execute straight on the NAV Developer Preview VM. It installs my modules, and executes the conversion for all “wizards” in the database of the ServerInstance “NAV”, and shows the converted files in VSCode:
Find-Module | where author -eq waldo | Install-Module
Export-NAVALfromNAVApplicationObject -ServerInstance NAV -WorkingFolder c:\WorkingFolder -TargetPath c:\WorkingFolder\Result -Filter 'Name=*Wizard' -OpenResultFolderInVSCode