In this video, I show how to use DotNet in AL, even in the cloud version of Microsoft Dynamics 365 Business Central without using Azure Functions or other 3rd party hosting methods.
When you try to convert existing C/Side objects to AL the first attempts are typically done while scoping OnPrem. This gives an overview of the errors to be fixed w.o things like DotNET.
In this phase you typically switch between C/Side and Visual Studio Code all the time fixing the errors one-by-one and reconverting.
During the year, I have rolled up to several of the Dynamics NAV 2018 cumulative upgrades implementing new functionalities and unfortunately also fixed multiple errors in the standard application.
Upgrading to Dynamics NAV 2018 CU 5: the sales lines started to give the error: Another user has changed the sales line. Just entering the Line Type, The Item No. and the Unit of Measure code. Therefore, entering a line you needed to leave the document window and reenter to continue.
Finally Extensions V2 supports DotNet (At least in the Developer Preview.
But as soon as you fire this up, perhaps with the help of TXT2AL, you’re met with assemblies not resolved. Both assemblies from standard DotNet (from the global assembly cache) and standard NAV DLLs.
When developing Extensions for NAV, using the Modern Development Environment in Visual Studio Code, you cannot use .Net Interoperability. See this link if you want to read more about this subject.
So if you have NAV developments that use .Net and you want to move them into Extensions you will probably need to replace the logic implemented using .Net with something else.
Calculating exact Day, Time, No of Month in a Day, Number of days in a Year, Day of the Week and many more has always been a challenging point while writing code in NAV. Though you can manage to achieve this but anyhow you end up with many lines of code. But just twisting your code a little bit with some DotNet variable will bring you a broad smile in your face with just a single line of codes. For an example have a look into the below screenshot.