Latest Microsoft Dynamics 365 Blogs | CloudFronts - Page 2

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 :

Workaround to XMLPort not supported in Business Central

Problem Statement: While I was working on some custom EFT project, I thought of using XMLPort as it is the safest and easiest method to get the data successfully directly from the tables. Unfortunately, XMLPort is not supported to work on WebClient and I was stuck with writing code to do exactly what XMLPort would do.Also, another issue that Business Central d extension support is using File methods i.e Open, Write, Close, etc.   Introduction: In Business Central even if you’re not given explicit rights to deal with files directly there are streams using which we can be downloaded as files. Enough of introduction, let’s start working now! Pre-requisites: VS Code AL Language Extension Microsoft Dynamics Business Central. Demonstration: 1. Creation of File Contents: In this case, I’ve simply text string ‘Hello World!’ Although it’s perfectly possible to create more complicated strings such as XML contents using a combination of loops and text manipulating functions as needed.     2. Creation of Streams: Using  TempBlob.Blob.CREATEOUTSTREAM(Var_OutStream) initialize the OutStream.       Using Var_OutStream.WriteText(Var_FileContent) write the text to the BLOB       Using TempBlob.Blob.CREATEINSTREAM(Var_InStream) read the contents of BLOB to InStream variable.   3. Downloading the contents of the Streams to a file: Using DownloadFromStream(Var_Instream,FileName.FileExtension) download the contents of the InStream to a file.     Output:   Conclusion: That’s exactly how I was able to create a Custom Text File and download it in Business Central. You can even try with any type of text-based exports.

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 :

Managing with Multiple Legal Entity Data in Microsoft Dynamics NAV / Business Central

Problem Statement: Well, my client is a Trader of Oils & Fatty Acids and has multiple legal entities to perform various sets of operation on the TRUCK-LOAD(a.k.a. Load). One legal entity creates the Load and schedules it, while another manages with the freight requirements. The information is not shared between both the legal entities. Thus, we need to store the data separately.   Pre-requisites: For Microsoft Dynamics NAV: – C/Side Development Environment – Multiple legal entity(Company) setup For Microsoft Dynamics Business Central: – Visual Studio Code – AL Language Extension – Multiple legal entity(Company) setup Solution Design: 1. Create two Tables say LoadCompany1 and LoadCompany2 with same fields 2. Set DataPerCompany property is to TRUE on both the tables. 3. In NAV/ BC, there are common tables but the data into the tables are different. Thus, the system has to manage different version for a single table based on an entity that you’re currently working on. In this case, I need to set data in different tables and synchronize data between them as shown below. Code: 1. In this case, to synchronize data, I’ve used TRANFERFIELDS function. Syntax: DestinationRecord.TRANSFERFIELDS(SourceRecord) 2. To change between working companies for the given table, I’ve used CHANGECOMPANY function. Syntax: Record.CHANGECOMPANY(CompanyName) Output: Inserting Loads Inserting Loads from Table Company1 Load to Company 2 Load   After processing, the system Inserts the Load from Company 1 to Company 2     Modifying Loads: There is an existing Load in Company 2   Modifying the Load in Company1 should modify the Load in Company 2 as well     And that’s how I achieved synchronization of data between two companies in Business Central. In the same way, we can also do the same task in NAV as well. Thanks. Happy weekend 🙂

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  

Share Story :

Admin Center in Business Central

Introduction: What is Admin Center in Business Central on Cloud? How to use it and what are the implications? Admin Center is one of the newest features of Business Central On Cloud. Here, you can manage your environments and performs tasks related to your environment. Demonstration: To goto Admin Centre, visit the URL https://businesscentral.dynamics.com/<TENANTID>admin To visit the Admin Centre you should have the Global Administrator permission in Office 365. Environments: Here you can see a list of Environments. You cannot Create to Delete the production environment. Only you can Create or Delete Sandbox Environments. Viewing details of the Environment: Click on the Environment Name: Upgrade Settings: You can set the Time to auto upgrade your Tenant Environment. Copying of Production on Sandbox: Notification Recipient: Notification Recipient is a person to notify in case there are some things to notify the user about. I thought it was with regards to Sandbox Upgradation but I didn’t get any updates during, before or after graduation. In fact, even when the Sandbox was not working it did not send an email. Telemetry: Telemetry shows the logs of Events that were triggered and shows the list of errors. Telemetry also shows which Codeunits were executed and at what time. This is a cool tool to know if there are any errors occurring when running your sandbox/production. It is like an Event Log for Business Central Conclusion: Thus using Admin Center you can get details about the Business Central. You can manage different environments, copy Production environment into Sandbox and Monitor the environments.

Share Story :

How to Attach Documents to any Record of any Table in Business Central

Introduction: Attachment is a relatively new functionality in Business Central. Unlike Links you need not store the links to the document but attach the document itself. In this blog I’ll be showing how to customize Business Central to attach documents to any table. Pre-requisite: VS Code Microsoft Dynamics Business Central Demonstration: Attachments are stored in Table 1173 Document Attachment Table. Using the standard document attachment table functionality does not support attaching on all the tables / pages. Currently in Business Central attachment functionality is allowed only on Master and Documents. Adding a field in Document Attachment Table to classify if you want to attach documents for different purpose. In this case I wanted to Attach two types of Documents. So I created an Option Type with Scale Ticket and Lab Report which will be set during the insertion of attachment in the Page. Refer: SaveAttachment2 function. Creating a Custom page with Source table as Table 1173 Attachment Document. I’ve created a Custom Page because the standard pages calls a function that does not allow me to attach different types of attachment. Thus the Custom page contains SaveAttachment2 function which allows to mention the type of Attachment for the record. Adding Custom methods to Attach the documents with different types on Single Record. i.) Export : This function downloads the attachment that is stored in the system wen clicked on the name ii.) SaveAttachment2:This function saves the attachment for the record with the specific type of attachment. It stores the TableID, Record Primary Key and then LoadType to specify type of attachment for that load. GetLoadType: This function is used to pass the type Calling the CustomAttachedPage from the Page/ Table you want to attach. Output: From the Record you want to attach the document To download the Attachment, click on the Attachment FileName. Conclusion: In this way we can attach documents to any record of any table in Business Central.

Share Story :

Sending Email from Admin on behalf of sender in Business Central using MS Flows

Introduction: In Business Central, to send an Email the sender Email is always the user in SMTP Setup. But, what happens when you are sending email from <admin@yourorganization.com> but should be going department wise ie. <sales@yourorganization.com> and <marketing@yourorganization.com>. Thus in this blog I’ll be showing how to send email from the department email using the admin email. Pre-requisite: 1. VS Code. 2. Office 365. 3. Microsoft Dynamics Business Central. 4. MS Flows. Demonstration: 1. Setting Up MS Flows: Creating the HTTP request: Using Sample Payload as : [{ “sender”:”Test Sender”, “recepient”:”Test recepient”, “subject”:”Test Subject”, “body”:”Test body” }] Add the  Send an Email action: Save the MS Flow and copy the trigger URL in  Postman and passing JSON, check if you the email. Check mail box for delivery of Email 2. Enable email delegation in Office 365. In portal.office.com, navigate to Admin > Admin Center > Exchange > Mail boxes > <–Admin Email–> > Delegate Add you department email here. In this cas Cloudfronts@xyz.com is admin email and olisterr@xyz.com is department email. 3. Call the MS Flows from Business Central. Code: 4. Output Conclusion: Thus in this way we can use MS Flows Webhooks to actually trigger an email passing the data through JSON as an POST http request.

Share Story :

How you can write Customization just specifically to create a profile

Introduction: Have you ever wondered how you can customize Business just for a specific profile and how tedious it can be for each and every profile? Well the answer is here and its simple than you expect. In this blog I’m going to how you can write Customization just specifically for the profile. Pre-requisites: 1. VS Code 2. Al Language Extension 3. Business Central Demonstration: 1. Creating a Profile Object: There are two different profile objects. i. Sales Manager Profile ii. Business Manager Profile. 2. Creating Page Customization for the Profile Object: There are two different Page Customization. i. SalesManager : Here, the ‘No.’ field on Customer List is hidden. ii. BusinessManager: Here, the ‘Name’ field on Customer List is hidden. 3. Linking between Profile Object and Page Customization: The name of the PageCustomization is the customization defined in the profile. Note: No variables, procedures and triggers are allowed on Page Customization. 4. Output: In My Setting > RoleCenters. You get two new Profiles. For Sales Manager Profile: No. field is hidden. For Business Manager Profile: Name field is hidden. Conclusion: Thus, in this way we can customize the app for specific profiles.

Share Story :

Difference in configuration of Role Center between NAV and Business Central.

Introduction: Difference in configuration of Role Center between Microsoft Dynamics NAV and Microsoft Dynamics 365 Business Central. Pre-requisites: Microsoft Dynamics NAV Microsoft Dynamics Business Central Solution: In Microsoft Dynamics NAV After creation of Role Center. When assigning the Role Center Page to the User the following process is followed. 1. Creating a new Profile in NAV for the and assign the Role Center Page ID . 2. Assigning the User Profile in User Personalization. In Microsoft Dynamics Business Central: 1. Creating a new Profile in Business Central for the required Role Center and assign the Role Center Page ID. 2. Selecting the User Profile directly in the Settings. Conclusion: This is the difference when configuring Role Center Page in NAV and Business Central

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange