Microsoft Dynamics Business Central Development – Technical Deep Dive
How do Extensions for Dynamics NAV Work?
With NAV Extensions, you can add functionality without changing the standard solution from Microsoft. This has the obvious advantage that major NAV upgrade projects are no longer necessary. Once you are using Extensions, the customizations no longer represent a problem when upgrading to the latest version of the solution.
Extensions for Microsoft Dynamics follow a model where you define the functionality as an addition to existing objects. This is how extensions can modify objects to perform business operations. We can develop multiple extensions so that development concerns are isolated and modularized but there is still a limitation under which these extensions perform that is the challenge.
Downloads
Article (PDF-276 KB)MOST POPULAR INSIGHTS
- Optimizing Container Image Pull Efficiency: A Technical Deep Dive
- Streamline Your Application Delivery with AWS AppStream 2.0: An Introduction
- Secure Communication in a Hybrid Cloud – A Case of Site-to-Site VPN on AWS
- Understanding, Communicating and Making Informed Decisions with Data Visualization
- Cross-Account, Cross-Region Backups in AWS
The Challenge
All the functionalities from Dynamics are inherited to extensions but what if a development use case needs certain functionalities that are beyond the scope of Dynamics?
Here comes the Add-In Development for Business Central to rescue. Which provides a clean way to integrate .NET Framework assemblies to Dynamics NAV Server. This opened a lot of possibilities and eventually helped us drive the development smoothly.
One of the many use cases we had was to leverage Microsoft Active Directory user permissions to perform File Operations (Create/Update/Delete) on a Shared Network Drive. There is no built-in support for Active Directory in Dynamics NAV so we used our home-made .NET assembly which encapsulated all the critical File Operations. The basic setup for such Add-In development is provided below for reference.
Add-In Development – Technical Deep Dive
You can take advantage of .NET Framework interoperability so that Dynamics NAV objects can interact with .NET Framework objects. In your extensions, you can reference .NET Framework assemblies and call their members directly from C/AL code.
For easier understanding, we will develop a custom .NET class library that exposes a single method `CreateFile` which writes `Base64` encoded file to a specified location. Example code is provided below:
Now once you have the compiled DLL available, it’s time for Dynamics NAV .NET Interoperability to play its part.
Integrating .NET interoperability consists of the following three steps which are discussed in detail below:
1. Declaring the Assembly
To integrate .NET interoperability, the AL compiler needs to be pointed to the custom .NET assemblies. By default, the AL compiler is only pointed to the location of the default .NET assemblies. You need to explore the `settings.json` file and add your assembly path.
After the reference directory is added in `settings.json` you must declare the type in a `dotnet` construct provided by AL Language, and then reference it from code using the DotNet Variable type.
2. Execute members from .NET Assembly
After `dotnet` reference is created in AL, It’s time we can utilize the functionalities provided by our home-made assembly. We now need to create a `codeunit` which exposes an AL procedure
3. Publishing the extension
You now have everything in place, Just build the extension and you are almost ready to deploy the extension to your production environment.
When publishing an extension, the server will recompile code and try to resolve all the references to external assemblies. The compilation will only succeed if the server can locate and load all the referenced assemblies and types. Therefore, it is recommended to keep the same path for custom assembly on the development and Production business central environments.
Key Takeaways
Dynamics Nav has been helping customers improve their businesses by providing valuable insights. At Xgrid, it helped our application developers expand the existing functionality through customization by adding more functionality using business central extensions. Microsoft Dynamics has a variety of features to boost productivity and is a fast, easy to use, and reliable solution to improve the overall efficiency of the business. Microsoft Dynamics improved forecasting, scheduling, management, and scalability with all other integrated applications.
With business logic in its DNA business central has made many businesses survive making it a broad and deep functionality that runs thousands of companies all over the globe. To evolve and progress all contemporary business models should shift towards Business Central’s up-to-date solutions.
Established in 2012, Xgrid has a history of delivering a wide range of intelligent and secure cloud infrastructure, user interface and user experience solutions. Our strength lies in our team and its ability to deliver end-to-end solutions using cutting edge technologies.
OFFICE ADDRESS
US Address:
Plug and Play Tech Center, 440 N Wolfe Rd, Sunnyvale, CA 94085
Pakistan Address:
Xgrid Solutions (Private) Limited, Bldg 96, GCC-11, Civic Center, Gulberg Greens, Islamabad
Xgrid Solutions (Pvt) Ltd, Daftarkhwan (One), Building #254/1, Sector G, Phase 5, DHA, Lahore