Business Central Archives - Page 2 of 12 - - Page 2

Tag Archives: Business Central

Phases of Quality Control in Business Central – 6

In the pharmaceutical industry, quality doesn’t stop at the first inspection. Even after raw materials (RM) and finished goods (FG) pass initial testing, they may need to be retested over time to ensure they still meet quality standards. Retesting is done for various reasons—checking product stability, verifying shelf-life, or re-evaluating materials due to storage issues. If not managed properly, it can lead to delays, compliance risks, or even wasted inventory. With our GMP-compliant Quality module in Business Central, the retesting process becomes more structured and efficient. In this blog, we’ll look at how the system helps identify items due for retesting, track test results, and make informed inventory decisions. Items due for retesting Once the QA user completes the quality process and posts the inspection receipt, the system stores the retesting date on the item ledger entry. This ensures that retesting requirements are properly recorded and can be tracked throughout the product lifecycle. Retesting Worksheet The next step is to track and manage items due for retesting. Business Central simplifies this with the Retesting Worksheet, which allows QA teams to efficiently identify materials and products that need to be retested. With this approach, retesting becomes a structured and automated process, helping pharma companies stay compliant and maintain quality without operational bottlenecks. I Hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

Phases of Quality Control in Business Central – 4

In our previous blog, we walked you through the process of procuring high-quality raw materials and the essential quality checks that ensure only the best make it to production. Now that we’ve laid the groundwork, it’s time to ask: What happens next? How do we turn those raw materials into timely deliveries for our customers? That’s where the planning of sales orders comes in! In this blog, we’ll dive into the crucial steps of sales order planning, discussing how we manage demand, and ensure a seamless flow from order placement to delivery. Let’s take a closer look at how this next phase keeps everything running smoothly! Firm plan production order Released production order A Released Production Order in Business Central indicates that the production order has been finalized and is ready to begin production. Once released: Material Issue Production Journal We will continue the Finished good quality in the next blog! I Hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

Restoring a Deleted Posted Bank Reconciliation in Business Central: A Comprehensive Guide

Are you having trouble restoring a deleted posted bank reconciliation in Microsoft Dynamics 365 Business Central? In this blog, I’m going to guide you through the process of effectively restoring a deleted posted bank reconciliation and ensuring the accuracy of your financial records. You’ll learn the step-by-step procedure to re-post a deleted bank reconciliation, along with best practices to prevent future errors and maintain the integrity of your financial data. Let’s get started! Steps to Achieve Goal: page 50100 BankLedgerEntryEditable {     ApplicationArea = All;     Caption = ‘Bank Ledger Entry Editable’;     PageType = List;     SourceTable = “Bank Account Ledger Entry”;     UsageCategory = Lists;     Permissions = tabledata “Bank Account Ledger Entry” = RIMD;     layout     {         area(Content)         {             repeater(General)             {                 field(“Document No.”; Rec.”Document No.”)                 {                     ToolTip = ‘Specifies the document number on the bank account entry.’;                 }                 field(“Statement No.”; Rec.”Statement No.”)                 {                     ToolTip = ‘Specifies the bank account statement that the ledger entry has been applied to, if the Statement Status is Bank Account Ledger Applied.’;                 }                 field(“Statement Line No.”; Rec.”Statement Line No.”)                 {                     ToolTip = ‘Specifies the number of the statement line that has been applied to by this ledger entry line.’;                 }                 field(“Statement Status”; Rec.”Statement Status”)                 {                     ToolTip = ‘Specifies the statement status of the bank account ledger entry.’;                 }                 field(Amount; Rec.Amount)                 {                     ToolTip = ‘Specifies the amount of the entry denominated in the applicable foreign currency.’;                 }                 field(“Amount (LCY)”; Rec.”Amount (LCY)”)                 {                     ToolTip = ‘Specifies the amount of the entry in LCY.’;                 }                 field(“Posting Date”; Rec.”Posting Date”)                 {                     ToolTip = ‘Specifies the posting date for the entry.’;                 }             }         }     } } pageextension 50101 PostedBankAccRecon extends “Bank Account Statement List” {     trigger OnDeleteRecord(): Boolean     begin         Error(‘You cannot delete a bank account reconciliation entry.’);     end; } To conclude, by following these steps, you can successfully undo a deleted posted bank reconciliation in Business Central. The process involves editing the Bank Ledger Entry, recreating the bank reconciliation with the same details, and ensuring the previously deleted reconciliation is removed through AL. With this approach, you maintain accurate financial records and ensure that your bank account reconciliation process runs smoothly without any discrepancies. If you need further assistance or have specific questions about your Business Central setup, feel free to reach out for personalized guidance.  Happy Reconciliation! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

Seamless Integration: How to Sync Business Central with External Systems Instantly or in Batches

In today’s fast-paced business world, integrating your ERP system (like Business Central) with other external systems is crucial for streamlining processes and ensuring data consistency. However, if you’re new to API integrations or struggling with how to send data from Business Central to another system, don’t worry! In this post, I am going to walk you through the process of sending data from Business Central to an external system using APIs. By the end of this guide, you’ll have a clear understanding of how to perform integrations smoothly, without the complexity. Steps to Achieve Goal: You can easily send data from Business Central to an external system by calling the link set in General Ledger Setup. Below is the logic for sending data via an API. You can encapsulate this logic inside a Codeunit, and call it as needed based on your synchronization requirements: Real-Time Data Sync: If you want the data to be synced in real-time (for example, as soon as new data is entered into Business Central), you can call the procedure within the OnAfterInsert() trigger. This ensures that every time a new record is created, it automatically triggers the procedure to send the data. trigger OnAfterInsert() begin     SendPostRequest(Rec); end; Batch Data Sync: If you prefer to sync the data at the end of a batch process (for example, at the end of the day), you can loop through the records using FindSet() and then call the procedure inside the loop. This will send data in bulk at a scheduled time rather than in real-time. procedure SyncDataInBatch() var     Rec_SO: Record “Sales Header”; begin    Rec_SO.setrange(CreatedAt,today()); // Apply any filter as per your need.     if Rec_SO.FindSet() then         repeat             SendPostRequest(Rec_SO);         until Rec_SO.Next() = 0; end; // Below is the logic for posting data from BC to Third Party Applications via API   procedure SendPostRequest(var Rec_SO: Record “Sales Header”)     var         HttpClient: HttpClient;         HttpContent: HttpContent;         HttpResponseMessage: HttpResponseMessage;         HttpRequestMessage: HttpRequestMessage;         JsonObject: JsonObject;         JsonText: Text;         Rec_GLE: Record “General Ledger Setup”;         contentHeaders: HttpHeaders;         OutPutString: Text;     begin           Rec_GLE.Get();         Rec_GLE.TestField(“API Link”); // where the other system API link has been stored and we are using via AL         HttpRequestMessage.SetRequestUri(Rec_GLE.”API Link”);         HttpRequestMessage.Method := ‘POST’;         JsonObject.Add(‘system_id’, Rec_SO.SystemId); // Passing Sales Header System ID(GUID)         JsonObject.Add(‘document_number’, Rec_SO.”No.”); // Passing Sales Header No         JsonObject.Add(‘type’, ‘ReleasedSalesInvoice’); // Passing Sales Header type         JsonObject.WriteTo(JsonText);         HttpContent.WriteFrom(JsonText);           HttpContent.GetHeaders(contentHeaders);         contentHeaders.Add(‘charset’, ‘UTF-8’);         contentHeaders.Remove(‘Content-Type’);         contentHeaders.Add(‘Content-Type’, ‘application/json; charset=utf-8’);           HttpRequestMessage.Content(HttpContent);         if HttpClient.Send(HttpRequestMessage, HttpResponseMessage) then             if HttpResponseMessage.IsSuccessStatusCode then begin                 HttpResponseMessage.Content.ReadAs(OutPutString);                 Message(‘%1’, OutPutString);             end             else                 Error(‘Error %1’, HttpResponseMessage.ReasonPhrase);     end; Conclusion: To conclude, sending data between Business Central and other systems is not as complicated as it might seem. By following the steps outlined above, you’ll be able to create smooth, efficient integrations that will save time, reduce errors, and improve your business processes. Happy Coding! We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

Business Central Translations: Working with XLIFF Files – Part 2

By the end of this guide, you will be able to generate, edit, and implement XLIFF files in Microsoft Dynamics 365 Business Central to support multiple languages seamlessly. This will enable your application to display translated content for UI labels, reports, and messages, ensuring a smooth experience for users across different regions. Why does this matter? Using XLIFF files, businesses can easily localize Business Central applications without modifying source code, making multilingual support efficient and scalable. By leveraging tools like NAB AL Tools, translations can be managed effortlessly, enhancing global usability. Generating an XLIFF File To illustrate the XLIFF process, let’s go through an example where we add a custom field named “Custom_Field” on the Customer Card page. Step 1: Creating a Custom Field First, we create a new field, Custom_Field, on the Customer Card page using AL code: Step 2: Enabling Translation File Feature In the app.json file, ensure that the TranslationFile feature is enabled: Step 3: Building the Project Now, build the extension using the shortcut CTRL + Shift + B. This will generate an .xlf file automatically in the translation folder. By default, the file is generated in English (en-US). Using NAB Extension for Translation To simplify translation tasks, you can install the NAB AL Tools extension from the Visual Studio Code marketplace. This extension helps in managing translation files efficiently by allowing automated translation suggestions and quick file updates. Steps to Use NAB AL Tools: A) Install NAB AL Tools. B) Press CTRL + Shift + P and select NAB: Create translation XLF for new language. C) Enter the language code (e.g., fr-FR for French – France). D) Choose Yes when prompted to match translations from BaseApp. E) A new fr-FR.xlf file will be generated. Translating the XLIFF File To translate the XLIFF file into another language (e.g., French), follow these steps: Example: Translating Report Labels In Business Central RDLC reports, hardcoded text values can also be translated using labels. Instead of writing static text, define labels within the AL code: Using FieldCaption ensures that report labels dynamically adapt to the selected language, improving localization without manual modifications. When switching languages, the label automatically retrieves the corresponding translation from the XLIFF file. Modifying Standard Fields Standard field names in Business Central can also be modified using the BaseApplication.g.xlf file. You can find this file in public repositories, such as: BaseApplication.g.xlf Modifying this file allows changes to default field captions and system messages in multiple languages. Insert value in different languages via AL In Microsoft Dynamics 365 Business Central, AL enables efficient multilingual data handling. The image above illustrates a Customer Card where the “Nom” (Name) field contains the value “testing.” The AL code extends the Customer table, adding a custom field and an onInsert trigger to validate the Name field with “testing.” This ensures data consistency across different language settings. By leveraging AL, developers can automate multilingual field values, enhancing Business Central’s global usability. To conclude, managing translations in Business Central using XLIFF files enables businesses to support multiple languages efficiently. By generating XLIFF files, modifying them for translation, and leveraging tools like NAB AL Tools, businesses can ensure accurate and seamless localization. For further refinements, modifying report labels and system fields enhances multilingual support, improving the user experience across global deployments. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

Business Central Translations: Language Setup and Customization – Part 1

In today’s globalised world, firms frequently operate in numerous areas and languages. To efficiently manage worldwide operations, software with multilingual capabilities is required. Microsoft Dynamics 365 Business Central (BC) includes a powerful translation system that enables enterprises to customise language choices, thereby increasing user experience and operational efficiencies. This article looks at how translations function in Business Central and how they may be used to support global business operations. Why Are Translations Important in Business Central? Businesses that expand into new areas face a variety of languages, currencies, and regulatory regimes. Ensuring that employees can interact with Business Central in their native language improves the software’s usability and productivity. Business Central allows users to configure numerous languages across various modules, allowing workers to work smoothly in their favourite language. It also allows translations for custom fields, reports, and data entry, assuring consistency and correctness in both internal and external interactions. How Translation Works in Business Central Business Central supports several languages, including English, French, German, and Spanish. Here’s an outline on how to activate and use translations successfully. 1. Configuring Language Settings The first step in enabling multilingual support is to configure the Language Settings in Business Central. Users can choose their favourite language or use the organization’s default language settings. This guarantees that when a user logs in, the interface, menus, and forms appear in their preferred language. To configure a language in Business Central: 2. Standard Text Translations Business Central provides built-in translations for standard interface elements and commonly used terms such as “Sales Orders,” “Invoices,” and “Purchase Orders.” These translations are included in the base application by Microsoft. For example, changing the language from English to French automatically updates the captions. However, some standard texts may not be translated by default. To install additional language support: Once installed, the system updates with the new language settings, ensuring a localized user experience. 3. Translating Custom Fields Many businesses customize Business Central by adding custom fields, tables, and industry-specific terminology. While these enhancements improve operational efficiency, they may not be automatically translated in the base system. To resolve this, Business Central provides the CaptionML property, which allows developers to define multilingual captions for custom elements. Example: English: Displays field names and labels in English. French: The same fields are shown with French translations. By implementing the CaptionML property, businesses ensure a seamless multilingual experience even for customized elements. To conclude, Microsoft Dynamics 365 Business Central makes it simple for multinational companies to handle multilingual customers. Companies can improve usability and efficiency across regions by changing language settings, adding extra translations, and ensuring that custom fields are translated using CaptionML. Embracing Business Central’s translation skills enables firms to operate efficiently in a global market while providing a consistent and localized experience to all users. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

A Comprehensive Guide to Backups and Restores in Dynamics 365 Business Central

Managing your organization’s data effectively is a critical task for ensuring business continuity. Dynamics 365 Business Central simplifies this process by offering built-in backup and restore features via the Business Central Admin Center. In this blog, we’ll explore how you can utilize these features to safeguard your environment and handle potential mishaps. Overview of Backups in Dynamics 365 Business Central Business Central automatically manages backups for your production and sandbox environments. These backups are stored securely for a limited period, allowing administrators to restore environments when needed. The retention period and capabilities for restoring backups are influenced by the environment type (production or sandbox). Key Features of the Backup System Restoring an Environment Restoring an environment is a straightforward process, ensuring minimal downtime. Follow these steps to restore an environment using the Admin Center: Step 1: Access the Admin Center Log in to the Business Central Admin Center using your administrator account. Step 2: Select the Environment Navigate to the Environments page and select the environment you wish to restore. Step 3: Initiate the Restore Process Click on the Restore button and choose a backup point from the available restore options. Step 4: Configure Restore Options Step 5: Confirm the Action Review the details and confirm the restore. The system will notify you once the process is complete. To encapsulate, the backup and restore functionalities in Dynamics 365 Business Central offer a reliable safety net for your organization’s data. By leveraging the Admin Center, administrators can easily safeguard business continuity and minimize risks associated with data loss or corruption. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

Visualizing Data: How to Add Power BI Reports to Business Central

Power BI is a great tool for turning data into clear, interactive reports and the best part?  It works smoothly with Business Central, right out of the box.  You just need to set it up, and you can start viewing powerful reports right inside within Business Central dashboard.  Microsoft provides several ready-made reports, grouped into different apps, so you can pick and install only what you need.  Once set up, these reports help you track key business insights without switching between systems.  In this blog, we’ll walk you through how to set up and use Power BI reports in Business Central to make smarter decisions. References Introduction to Business Central and Power BI Install Power BI apps for Business Central Configuration Open your Business Central and search for “Assisted Setup”. Click on “Connect to Power BI” Once the set up page opens, click on Next. Fiscal: A 12-month calendar that begins in any month and ends 12 months after. Standard: A 12-month calendar that begins on January 1 and ends on December 31. Weekly: A calendar that supports 445, 454, or 544 week groupings.The first and last day of the year might not correspond to a first and last day of a month, respectively. Specify the time zone. Specify the working days. Here, it asks for configuring individual apps for Power BI. You can skip this for now as we’ll be back at this later. In the next screen, specify the environment name and the company name. Now, we’ll install the “D365 Business Central – Sales” app in Power BI. Go to your Power BI dashboard and click on Apps.  Search for Business Central Open the relevant one and click on “Get it now” Then click on “Install” Wait for a few seconds till the installation is complete. Now, when you open the report for the first time, it’ll show the report with sample data. To view it with your own data, we need to connect the data to Business Central. Enter the company and environment name. Specify the authentication method to OAuth 2.0 and click on “Sign in and connect” After a few minutes, the refresh will be completed and you’ll see your data. Once this is done, search for “Power BI Connector Setup” In the relevant tab, Sales Report for this example, click on “Power BI Sales” field’s drill down. Select the app that you installed. Now go back to your Business Central dashboard and scroll down to the “Power BI” section. Click on the “Get Started with Power BI” and keep clicking on Next till the end of the setup. If there are any selected reports, you will see the relevant report. If not, you’ll see the following-  In either case, click on the drop-down next to Power BI or click on the “Select reports” Scroll down to find the appropriate report and click on “Enable” and then click on Ok. You will see your Power BI report on the dashboard. You can enable multiple reports and cycle through them by clicking on the “Next” and “Previous” buttons. You can also expand the report to see it as a full page within Business Central by clicking on the “Expand” page. You can further view it in Fullscreen as well. If you want to see multiple reports on the same page, we can create a custom role center and add multiple reports to them. For example, I’ve created a “Power BI dashboard” role center. In this way, we can have n number of reports on our dashboard. Source Code – BCApps-PowerBIDashboard Setting up Power BI in Business Central is a simple way to bring your data to life.  With just a few steps, you can connect your reports, see real-time insights, and make better business decisions all without leaving Business Central.  Whether you need sales trends, financial reports, or custom dashboards, Power BI makes it easy to track what matters most. If you need further assistance or have specific questions about your Business Central and Power BI Integration, feel free to reach out for personalized guidance. We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfonts.com.

The Power of Real-Time Data: How Business Central Enhances Pharma Decision-Making

Consider the scenario of a pharmaceutical manufacturer facing an unexpected shortage of essential raw materials. This situation inevitably leads to production delays, potentially causing missed deadlines and expensive product recalls. In today’s dynamic pharmaceutical sector, where adherence to regulations and a responsive supply chain are crucial, outdated information poses a significant risk. What if these disruptions could be predicted and mitigated before they materialize? What if you had immediate, comprehensive visibility into your entire operational landscape? This is the advantage offered by real-time data, and solutions like Microsoft Business Central are spearheading the evolution of pharmaceutical decision-making. The Shortcomings of Traditional Pharmaceutical Data: Historically, the pharmaceutical industry has operated with data that is often delayed. Reports generated several days or weeks after events occur provide a historical perspective, lacking the current operational awareness needed for effective management. This results in: Real-Time Data: A Game-Changer for Pharma: Our Business Central Pharma module provides a unified platform that delivers real-time visibility across your entire pharmaceutical operation. This empowers you to: Practical Implementation and Tangible Benefits: Implementing Business Central can seem daunting, but the benefits are undeniable. By having the end-to-end process in one system can be very beneficiary. The Future of Data-Driven Pharma: The future of pharma lies in leveraging the power of data. Imagine being able to anticipate potential supply chain disruptions or quality issues before they occur. This is the promise of data-driven Pharma Module. To encapsulate, in the pharmaceutical industry, where precision and speed are critical, real-time data is no longer a luxury—it’s a necessity. Our Business Central pharma module helps companies to embrace the data revolution, enabling faster, more informed decisions that drive efficiency, compliance, and growth. Ready to unlock the power of real-time data for your pharmaceutical operations? Contact us today at transform@cloudfonts.com to learn how our Business Central pharma module can transform your business.

Enhancing the Recurring General Journal with Automated Approval Workflows in Dynamics 365 Business Central

In any accounting or financial system, ensuring that the proper approvals are in place is critical for maintaining audit trails and accountability. Microsoft Dynamics 365 Business Central (BC) offers powerful approval workflows that can automate this process, ensuring compliance and accuracy in your financial entries. This blog will guide you through creating an extension for the Recurring General Journal page, enabling automated approval requests for journal batches and journal lines. Understanding the Recurring General Journal The Recurring General Journal in Business Central allows users to post transactions that occur periodically, such as monthly expenses. However, posting journal entries often requires an approval process to guarantee compliance and accuracy. Our extension will empower users to request approvals, cancel requests, and manage the approval status directly from the Recurring General Journal. Solution Outline This extension will: Code Here’s the complete PageExtension code that extends the Recurring General Journal page: pageextension 50103 RecurringGenJnl extends “Recurring General Journal” {     layout     {         addafter(CurrentJnlBatchName)         {             field(StatusLine; Rec.StatusBatch)             {                 ApplicationArea = All;                 Caption = ‘Approval Status’;                 Editable = false;                 Visible = true;             }         }     }     actions     {         addafter(“F&unctions”)         {             group(“Request Approval”)             {                 Caption = ‘Request Approval’;                 group(SendApprovalRequest)                 {                     Caption = ‘Send Approval Request’;                     Image = SendApprovalRequest;                     action(SendApprovalRequestJournalLine)                     {                         ApplicationArea = Basic, Suite;                         Caption = ‘Journal Batch’;                         Image = SendApprovalRequest;                         Enabled = true;                         ToolTip = ‘Send all journal lines for approval, also those that you may not see because of filters.’;                         trigger OnAction()                         var                             GenJournalLine: Record “Gen. Journal Line”;                             GenJournalBatch: Record “Gen. Journal Batch”;                             ApprovalsMgmt: Codeunit “Approvals Mgmt.”;                             IsLineValid: Boolean;                         begin                             GenJournalBatch.Get(Rec.”Journal Template Name”, Rec.”Journal Batch Name”);                             if GenJournalLine.SetCurrentKey(“Journal Template Name”, “Journal Batch Name”) then begin                                 GenJournalLine.SetRange(“Journal Template Name”, GenJournalBatch.”Journal Template Name”);                                 GenJournalLine.SetRange(“Journal Batch Name”, GenJournalBatch.”Name”);                                 if GenJournalLine.FindSet() then                                     ApprovalsMgmt.TrySendJournalBatchApprovalRequest(GenJournalLine);                                 SetControlAppearanceFromBatch();                                 SetControlAppearance();                             end;                         end;                     }                 }                 group(CancelApprovalRequest)                 {                     Caption = ‘Cancel Approval Request’;                     Image = Cancel;                     Enabled = true;                     action(CancelApprovalRequestJournalBatch)                     {                         ApplicationArea = Basic, Suite;                         Caption = ‘Journal Batch’;                         Image = CancelApprovalRequest;                         ToolTip = ‘Cancel sending all journal lines for approval, also those that you may not see because of filters.’;                         trigger OnAction()                         var                             ApprovalsMgmt: Codeunit “Approvals Mgmt.”;                             GenJournalBatch: Record “Gen. Journal Batch”;                             GenJournalLine: Record “Gen. Journal Line”;                             IsLineValid: Boolean;                         begin                             GenJournalBatch.Get(Rec.”Journal Template Name”, Rec.”Journal Batch Name”);                             //ApprovalsMgmt.TryCancelJournalBatchApprovalRequest(GenJournalLine);                             if GenJournalLine.SetCurrentKey(“Journal Template Name”, “Journal Batch Name”) then begin                                 GenJournalLine.SetRange(“Journal Template Name”, GenJournalBatch.”Journal Template Name”);                                 GenJournalLine.SetRange(“Journal Batch Name”, GenJournalBatch.”Name”);                                 if GenJournalLine.FindSet() then                                     IsLineValid := true;                                 if (GenJournalLine.Status.ToUpper() = ‘OPEN’) or                                    (GenJournalLine.Status.ToUpper() = ‘APPROVED’) then begin                                     IsLineValid := false;                                 end;                                 if IsLineValid then                                     ApprovalsMgmt.TryCancelJournalBatchApprovalRequest(GenJournalLine);                                 //ApprovalsMgmt.TryCancelJournalLineApprovalRequests(GenJournalLine);                             end else begin                                 Message(‘Gen. Journal Batch not found for the provided template and batch names.’);                             end;                             SetControlAppearanceFromBatch();                             SetControlAppearance();                         end;                     }                 }                 group(Approval)                 {                     Caption = ‘Approval’;                     action(Approve)                     {                         ApplicationArea = All;                         Caption = ‘Approve’;                         Image = Approve;                         ToolTip = ‘Approve the requested changes.’;                         Visible = true;                         trigger OnAction()                         var                             ApprovalsMgmt: Codeunit “Approvals Mgmt.”;                         begin                             ApprovalsMgmt.ApproveGenJournalLineRequest(Rec);                         end;                     }                     action(Reject)                     {                         ApplicationArea = All;                         Caption = ‘Reject’;                         Image = Reject;                         ToolTip = ‘Reject the approval request.’;                         Visible = true;                         trigger OnAction()                         var                             ApprovalsMgmt: Codeunit “Approvals Mgmt.”;                         begin                             ApprovalsMgmt.RejectGenJournalLineRequest(Rec);                         end;                     }                     action(Delegate)                     {                         ApplicationArea = All;                         Caption = ‘Delegate’;                         Image = Delegate;                         ToolTip = ‘Delegate the approval to a substitute approver.’;                         Visible = OpenApprovalEntriesExistForCurrUser;                         trigger OnAction()                         var                             ApprovalsMgmt: Codeunit “Approvals Mgmt.”;                         begin                             ApprovalsMgmt.DelegateGenJournalLineRequest(Rec);                         end;                     }                 }             }         }     }     trigger OnOpenPage()     begin         SetControlAppearanceFromBatch();     end;     trigger OnAfterGetCurrRecord()     var         GenJournalBatch: Record “Gen. Journal Batch”;     begin         EnableApplyEntriesAction();         SetControlAppearance();         if GenJournalBatch.Get(GetJournalTemplateNameFromFilter(), CurrentJnlBatchName) then             SetApprovalStateForBatch(GenJournalBatch, Rec, OpenApprovalEntriesExistForCurrUser, OpenApprovalEntriesOnJnlBatchExist, OpenApprovalEntriesOnBatchOrAnyJnlLineExist, CanCancelApprovalForJnlBatch, CanRequestFlowApprovalForBatch, CanCancelFlowApprovalForBatch, CanRequestFlowApprovalForBatchAndAllLines, ApprovalEntriesExistSentByCurrentUser, EnabledGenJnlBatchWorkflowsExist, EnabledGenJnlLineWorkflowsExist);         ApprovalMgmt.GetGenJnlBatchApprovalStatus(Rec, Rec.StatusBatch, EnabledGenJnlBatchWorkflowsExist);     end;     trigger OnAfterGetRecord()     var         GenJournalLine: Record “Gen. Journal Line”;         GenJournalBatch: Record “Gen. Journal Batch”;         ApprovalsMgmt: Codeunit “Approvals Mgmt.”;     begin         GenJnlManagement.GetAccounts(Rec, AccName, BalAccName);         Rec.ShowShortcutDimCode(ShortcutDimCode);         SetUserInteractions();         GenJournalBatch.Get(Rec.”Journal Template Name”, Rec.”Journal Batch Name”);         if GenJournalLine.SetCurrentKey(“Journal Template Name”, “Journal Batch Name”) then begin             GenJournalLine.SetRange(“Journal Template Name”, GenJournalBatch.”Journal Template Name”);             GenJournalLine.SetRange(“Journal Batch Name”, GenJournalBatch.”Name”);             if GenJournalLine.FindSet() then                 repeat                     ApprovalMgmt.GetGenJnlLineApprovalStatus(Rec, Rec.StatusBatch, EnabledGenJnlLineWorkflowsExist);                 until GenJournalLine.Next() = 0;         end;     end;     trigger OnModifyRecord(): Boolean     var         GenJournalBatch: Record “Gen. Journal Batch”;         GenJournalLine: Record “Gen. Journal Line”;         ApprovalsMgmt: Codeunit “Approvals Mgmt.”;         IsLineValid: Boolean;     begin         SetUserInteractions();         ApprovalMgmt.CleanGenJournalApprovalStatus(Rec, Rec.StatusBatch, Rec.Status);         if Rec.StatusBatch = ‘Pending Approval’ then             Error(‘Modification not allowed. The journal batch “%1” has entries with a status of “Pending Approval”. Please approve, reject, or cancel these entries before making changes.’, GenJournalBatch.”Name”);     end;     var         GenJnlManagement: Codeunit GenJnlManagement;         JournalErrorsMgt: Codeunit “Journal Errors Mgt.”;         BackgroundErrorHandlingMgt: Codeunit “Background Error Handling Mgt.”;         ApprovalMgmt: Codeunit “Approvals Mgmt.”;         ChangeExchangeRate: Page “Change Exchange Rate”;         GLReconcile: Page Reconciliation;         GenJnlBatchApprovalStatus: Text[20];         GenJnlLineApprovalStatus: Text[20];         Balance: Decimal;         TotalBalance: Decimal;         NumberOfRecords: Integer;         ShowBalance: Boolean;         ShowTotalBalance: Boolean;         HasIncomingDocument: Boolean;         BalanceVisible: Boolean;         TotalBalanceVisible: Boolean;         StyleTxt: Text;         ApprovalEntriesExistSentByCurrentUser: Boolean;         OpenApprovalEntriesExistForCurrUser: Boolean;         OpenApprovalEntriesOnJnlBatchExist: Boolean;         OpenApprovalEntriesOnJnlLineExist: Boolean;         OpenApprovalEntriesOnBatchOrCurrJnlLineExist: Boolean;         OpenApprovalEntriesOnBatchOrAnyJnlLineExist: Boolean;         EnabledGenJnlLineWorkflowsExist: Boolean;         EnabledGenJnlBatchWorkflowsExist: Boolean;         ShowWorkflowStatusOnBatch: Boolean;         ShowWorkflowStatusOnLine: Boolean;         CanCancelApprovalForJnlBatch: Boolean;         CanCancelApprovalForJnlLine: Boolean;         ImportPayrollTransactionsAvailable: Boolean;         CanRequestFlowApprovalForBatch: Boolean;         CanRequestFlowApprovalForBatchAndAllLines: Boolean;         CanRequestFlowApprovalForBatchAndCurrentLine: Boolean;         CanCancelFlowApprovalForBatch: Boolean;         CanCancelFlowApprovalForLine: Boolean;         BackgroundErrorCheck: Boolean;         ShowAllLinesEnabled: Boolean;         CurrentPostingDate: Date;     protected var         ApplyEntriesActionEnabled: Boolean;         IsSimplePage: Boolean;     local procedure EnableApplyEntriesAction()     begin         ApplyEntriesActionEnabled :=           (Rec.”Account Type” in [Rec.”Account Type”::Customer, Rec.”Account Type”::Vendor, Rec.”Account Type”::Employee]) or           (Rec.”Bal. Account Type” in [Rec.”Bal. Account Type”::Customer, Rec.”Bal. Account Type”::Vendor, Rec.”Bal. Account Type”::Employee]);         OnAfterEnableApplyEntriesAction(Rec, ApplyEntriesActionEnabled);     end;     local procedure CurrentJnlBatchNameOnAfterVali()     begin         CurrPage.SaveRecord();         GenJnlManagement.SetName(CurrentJnlBatchName, Rec);         SetControlAppearanceFromBatch();         CurrPage.Update(false);     end;     procedure SetUserInteractions()     begin         StyleTxt := Rec.GetStyle();     end;     local procedure GetCurrentlySelectedLines(var GenJournalLine: Record “Gen. Journal Line”): Boolean     begin         CurrPage.SetSelectionFilter(GenJournalLine);         exit(GenJournalLine.FindSet());     end;     local procedure GetPostingDate(): Date     begin         if IsSimplePage then             exit(CurrentPostingDate);         exit(Workdate());     end;     internal procedure SetApprovalState(RecordId: RecordId; OpenApprovalEntriesOnJournalBatchExist: Boolean; LocalCanRequestFlowApprovalForBatch: Boolean; var LocalCanCancelFlowApprovalForLine: Boolean; var OpenApprovalEntriesExistForCurrentUser: Boolean; var OpenApprovalEntriesOnJournalLineExist: Boolean; var OpenApprovalEntriesOnBatchOrCurrentJournalLineExist: Boolean; var CanCancelApprovalForJournalLine: Boolean; var LocalCanRequestFlowApprovalForBatchAndCurrentLine: Boolean)     var         ApprovalsMgmt: Codeunit “Approvals Mgmt.”;         WorkflowWebhookManagement: Codeunit “Workflow Webhook Management”;         CanRequestFlowApprovalForLine: Boolean;     begin         OpenApprovalEntriesExistForCurrentUser := OpenApprovalEntriesExistForCurrentUser or ApprovalsMgmt.HasOpenApprovalEntriesForCurrentUser(RecordId);         OpenApprovalEntriesOnJournalLineExist := ApprovalsMgmt.HasOpenApprovalEntries(RecordId);         OpenApprovalEntriesOnBatchOrCurrentJournalLineExist := OpenApprovalEntriesOnJournalBatchExist or OpenApprovalEntriesOnJournalLineExist;         CanCancelApprovalForJournalLine := ApprovalsMgmt.CanCancelApprovalForRecord(RecordId);         WorkflowWebhookManagement.GetCanRequestAndCanCancel(RecordId, CanRequestFlowApprovalForLine, LocalCanCancelFlowApprovalForLine);         LocalCanRequestFlowApprovalForBatchAndCurrentLine := LocalCanRequestFlowApprovalForBatch and CanRequestFlowApprovalForLine;     end;     internal procedure SetApprovalStateForBatch(GenJournalBatch: Record “Gen. Journal Batch”; GenJournalLine: Record “Gen. Journal Line”; var OpenApprovalEntriesExistForCurrentUser: Boolean; var OpenApprovalEntriesOnJournalBatchExist: Boolean; var OpenApprovalEntriesOnBatchOrAnyJournalLineExist: Boolean; var CanCancelApprovalForJournalBatch: Boolean; var LocalCanRequestFlowApprovalForBatch: Boolean; var LocalCanCancelFlowApprovalForBatch: Boolean; var LocalCanRequestFlowApprovalForBatchAndAllLines: Boolean; var LocalApprovalEntriesExistSentByCurrentUser: Boolean; var EnabledGeneralJournalBatchWorkflowsExist: Boolean; var EnabledGeneralJournalLineWorkflowsExist: Boolean)     var         ApprovalsMgmt: Codeunit “Approvals Mgmt.”;         WorkflowWebhookManagement: Codeunit “Workflow Webhook Management”;         WorkflowEventHandling: Codeunit “Workflow Event Handling”;         WorkflowManagement: Codeunit “Workflow Management”;         CanRequestFlowApprovalForAllLines: Boolean;     begin         OpenApprovalEntriesExistForCurrentUser := OpenApprovalEntriesExistForCurrentUser or ApprovalsMgmt.HasOpenApprovalEntriesForCurrentUser(GenJournalBatch.RecordId);         OpenApprovalEntriesOnJournalBatchExist := ApprovalsMgmt.HasOpenApprovalEntries(GenJournalBatch.RecordId);         OpenApprovalEntriesOnBatchOrAnyJournalLineExist := OpenApprovalEntriesOnJournalBatchExist or ApprovalsMgmt.HasAnyOpenJournalLineApprovalEntries(GenJournalLine.”Journal Template Name”, GenJournalLine.”Journal Batch Name”);         CanCancelApprovalForJournalBatch := … Continue reading Enhancing the Recurring General Journal with Automated Approval Workflows in Dynamics 365 Business Central

SEARCH :

FOLLOW CLOUDFRONTS BLOG :

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange