Category Archives: Dynamics NAV
Multiple Production Tenant in Dynamics 365 Business Central
Problem Statement: I have a requirement where the contents of the General Journals are to export to Excel and also can create new entries by importing the same Excel file as well. A major troublemaker is the dimensions as only Dimensions 1&2 ate stored in tables and can be validated easily but 3-8 are set at run-time through variables on the page. In this blog, I’ll be attempting to resolve how to automatically apply dimensions from 3-8 using the code. Pre-requisites: VS Code AL Language Extension Functional knowledge of Dimensions Microsoft Dynamics NAV / Business Central Solution: 1. Understanding how dimensions work technically: Any dimensions that are inserted in an entry in the system are validated to be stored in the Dimension Set Entries table. Dimension Set Entries table of which Dimension Set ID is set on the Table. This Dimension Set Entry ID is stored on the entries to be used as a reference. For instance, if we want to Apply Dimensions to General Journal Entries, the Dimension Set Entries ID is stored on General Journal Lines Table. Dimension Set ID on General Journals Out of 8 total dimensions, 2 dimensions are stored on the table. These 2 dimensions are also known as Global Dimensions. 2. Hack into Business Central: When importing, the entry either consists of a Dimension Set ID. If the Dimension Set ID is set to 0 which means no Dimension is applied yet. To apply the dimension to the entry using the code, we can use the standard available code ValidateShortcutDimCode(Dimension_No, Dimension_Value); Dimension_No: The position of the Dimension. Dimension_Value: Dimension Value that is to be applied. For Example:Rec_GenJnl.ValidateShortcutDimCode(3, SD3); When Exporting the Dimension into an Excel Format, you can use the Dimension Set ID present on the Entry to lookup into Dimension Set Entries Table. To Export the Dimensions using the code, you can use the following code: Clear(Rec_DimensionSetEntry); Rec_DimensionSetEntry.SetRange(“Dimension Set ID”, Rec_GenJnl.“Dimension Set ID”); Rec_DimensionSetEntry.SetRange(“Dimension Code”, Rec_GLSetup.“Shortcut Dimension 3 Code”); IF Rec_DimensionSetEntry.FindFirst() then MESSAGE(Format(Rec_DimensionSetEntry.“Dimension Value Code”)); Output: After Importing from Excel: After Exporting to Excel: Conclusion: Thus, using standard code present in Business Central, we can Import dimension details from other sources such as Excel. I also learned about the Dimension Set Entry table and how this is used to store the data on the Entry table using Dimension Set ID. Overall this is a big step where I learned how to import dimensions which are more than the 2 Global Dimension. Thanks for taking a keen interest in reading my blog.
Share Story :
Role Center(Dashboard) taking forever to Load? Let’s find out why and how to optimize!
Introduction: Have you ever faced the issue of the Dashboard taking forever to load? If yes, then did you inspect the reason why? Anyways, the Dashboard loading times dependent upon the calculations used to generate the figures on each of the dashboard tile. Most of the times the calculations are so tedious that the results involve querying multiple tables with multiple filters. Let’s see how we can optimize the Dashboard load times. Pre-requisites: Microsoft Dynamics NAV / Business Central. Development Environment or NAV. VS code with AL Language Extension for Business Central. Solution: 1. Figuring out which all tiles required real-time calculations VS non- real-time. Thus, by separating real-time from non- real-time, we can differentiate the execution patterns. For eg: No. of Open Invoices VS Average Cost of an Open Invoice. 2. Settings different execution styles for Real-Time and Non-Realtime: i. Real-Time Calculations are trigger whenever we open the Dashboard i.e OnOpenPage Trigger on Role center page ii. Whereas Non-Real time can be set up as Job which refreshes every 5-10 minutes. 3. Setting the Dashboard Source of Data as Tables. It is easier for the Dashboard to Load the data from Tables rather than executing the query and storing the data as variables and populate data. 4. Setting manual Refresh Button to refresh the data on all the tiles. Code & Output: 1. Creating the Role Center with Source Table as the Table: 2. Trigger on OnOpenPage to modify the values in the Source Table with new real-time values: 3. Create a Codeunit which run as a Job every 5 – 10 minutes and store the data into the Source Table: Creating Codeunit to be executed as a Job. Setting Codeunit on Job Queue Entries 4. Output: Conclusion: Thus using the optimization by using Table as the source of data for Role Center, we can reduce the load time exponentially to get a good performance. As per facts are concerned, in reality, the change in the load time was from 2 minutes 10 seconds to 15 seconds after the optimization.Happy Blogging! 🙂
Share Story :
Temporary fix to ‘Your program License doesn’t permit support maximum N non-demonstration companies’
Introduction: While I was testing InterCompany Setup, I faced an issue probably a limitation of the CRONUS standard license which comes with standard NAV/ BC On-Premise installations. Whenever I created new multiple Companies in NAV, I got an error ‘Your program License doesn’t permit support maximum N non-demonstration companies‘. Pre-requisites: Microsoft Dynamics NAV 2018. Microsoft Dynamics 365 Business Central. Solution: I faced this error when I restarted NAV Client after creating a non-evaluation company. Thus, I cannot remove the company from front-end. I tried using Microsoft Documentation and found that it was actually possible (YAY!! 😁). Refer https://docs.microsoft.com/en-us/dynamics-nav/how-to–delete-companies. Instead, it kept ruining things more. The Server Instance would stop without any errors and NAV Windows Client would infinitely work trying to connect to the workspace. Finally, I found that using Windows Powershell with NAV Management module where it was possible to delete the Company from the back-end. NOTE: 1. The database shouldn’t be in Single user mode. 2. The NAV Server Instance should be in RUNNING state. Powershell Commands and Outputs: Recreating the error by creating new companies. Creating a new Company! Changing to the new Company! Importing the NAVAdmin Powershell module which comes in the package when you install NAV/ BC On-Premise. Getting the list of Companies on the NAV Server Instance using PowerShell Removing the Company for a particular NAV Server instance Conclusion: I tried going into single user mode to delete the company from NAV Windows Client but it didn’t work