Business Central 2025 Wave 1 (BC26): Check Total Purchase Amounts on Documents

The Business Central 2025 Wave 1 (BC26) release introduces a valuable feature aimed at enhancing the accuracy and efficiency of accounts payable processes: “Check Doc. Total Amounts”. While seemingly simple from a user perspective, but powerful addition that helps users validate purchase documents before posting.

At its heart, “Check Doc. Total Amounts” is designed to prevent posting discrepancies between the manually entered total amounts on purchase document headers and the calculated total amounts based on the individual purchase lines. This helps ensure that the data within Business Central accurately reflects the external vendor invoices, minimizing potential errors and reconciliation issues.

Implementation Details:

Setup: The functionality is controlled via a new option within the Purchases & Payables Setup page. Administrators need to explicitly enable the “Check Doc. Total Amounts” toggle. This opt-in approach ensures that existing environments are not impacted unless the feature is intentionally activated.

New Fields: Upon enabling the feature, two new fields become visible on the Purchase Invoice and Purchase Credit Memo pages:

  • Doc. Amount Incl. VAT: This field is intended for users to enter the total amount, including VAT, as stated on the vendor’s document.
  • Doc. Amount VAT: This field allows users to enter the total VAT amount as per the vendor’s document.

Automatic Calculation: When a user enters a value in the “Doc. Amount Incl. VAT” field, the system automatically calculates and populates the “Doc. Amount VAT” field based on the VAT rates applied to the individual purchase lines. Conversely, if the user enters the “Doc. Amount VAT”, the “Doc. Amount Incl. VAT” is automatically calculated.

Validation on Posting: The crucial technical aspect lies in the posting validation logic. When a user attempts to post a Purchase Invoice or Purchase Credit Memo with the “Check Doc. Total Amounts” feature enabled, Business Central performs the following checks:

  • It calculates the sum of the “Amount Including VAT” for all individual purchase lines.
  • It calculates the total VAT amount based on the VAT entries of the purchase lines.
  • It compares these calculated totals with the values entered in the “Doc. Amount Incl. VAT” and “Doc. Amount VAT” fields on the document header.

Error Handling: If the calculated total amounts from the lines do not match the manually entered amounts on the header, the system will prevent posting and display an error message to the user. This forces a review of the purchase lines and header information to identify and rectify any discrepancies before the document can be posted.

The “Check Doc. Total Amounts” feature in Business Central 2025 Wave 1 (BC26) is a welcome addition for improving the accuracy of purchase document processing.

Stay tuned for more.

Embedding Powerful UI with UserControlHost PageType in Business Central

With the release of Business Central 2025 Wave 1, new page type UserControlHost is introduced which enables embedding custom JavaScript-based controls into the Business Central web client.

🔍 What is UserControlHost?

The UserControlHost page type allows you to embed custom client-side controls—typically written in JavaScript—inside the Business Central web client using the ControlAddIn object.These controls are built with web technologies—JavaScript, HTML, and CSS—and provide flexibility far beyond standard AL UI elements.

Think of UserControlHost as a “wrapper” that renders client-side controls defined via the ControlAddIn object.

You might consider using UserControlHost for:

  • Advanced data visualizations (charts, graphs, maps)
  • Dynamic dashboards or interactive UI widgets

🧱 How to use

To use the UserControlHost, you need two key components:

  1. A Control Add-In (ControlAddIn)
  2. A Page with PageType = UserControlHost
  1. Create the ControlAddIn
controladdin "MyWave2025Control"
{
    Scripts = 'scripts/chart.js', 'scripts/mycontrol.js';
    StartupScript = 'scripts/init.js';
    StyleSheets = 'styles/mycontrol.css';

    RequestedHeight = 400;
    RequestedWidth = 600;

    AutoAdjustHeight = true;
    AutoAdjustWidth = true;

    Events = OnItemSelected(text);
    Methods = LoadData(data: Text);
}

2) Create the UserControlHost Page

page 50200 "Dashboard Host"
{
    PageType = UserControlHost;
    ApplicationArea = All;

    layout
    {
        area(content)
        {
            usercontrol(MyCustomChart; "MyWave2025Control")
            {
                ApplicationArea = All;
            }
        }
    }

    trigger OnOpenPage()
    begin
        CurrPage.MyCustomChart.LoadData('{"region": "Thailand"}');
    end;

    trigger OnControlReady()
    begin
        Message('Custom Control is ready!');
    end;
}

The UserControlHost page type, especially with Wave 1 2025 enhancements, is the go-to choice for scenarios where traditional AL UI just won’t cut it. Whether you’re building modern dashboards, embedding custom charts, or creating interactive widgets

SessionInformation.Callstack() in Business Central

Introduced in Business Central Wave 1 2025 releases, the SessionInformation.Callstack() method is a powerful diagnostic tool that helps developers trace the current call stack within AL code. Whether you’re troubleshooting custom extensions, tracking errors, or building telemetry, this method can become your best friend.

What is the SessionInformation.Callstack() Method?

The SessionInformation.Callstack() method is a built-in function in AL that returns a text string representing the current call stack of the Business Central server session. Think of the call stack as a chronological list of the functions and procedures that have been called to reach the current point in your code.

Each entry in the call stack typically includes:

  • Object Type and Name: The type of object (e.g., Codeunit, Table, Page) and its name.
  • Function/Procedure Name: The specific function or procedure being executed.
  • Line Number: The line number within the function/procedure where the call originated.

📌 Syntax

var
    CallStackText: Text;
begin
    CallStackText := SessionInformation.Callstack();
end;

🧩 Why is the Call Stack Important?

Understanding the call stack is crucial for several reasons:

  • Debugging: When an error occurs, the call stack provides a trace of the execution path leading up to the error. This helps you pinpoint the exact location where the issue originated and understand the sequence of events that triggered it.
  • Error Handling: By capturing and logging the call stack when an error occurs, you can provide more context to administrators or support teams, making it easier to diagnose and resolve issues.
  • Code Understanding: Analyzing the call stack can help you understand the flow of execution in complex codebases, especially when working with unfamiliar code or trying to understand how different modules interact.

You can combine this with

  • ErrorInfo object (for AL error handling)
  • SessionInformation.UserId() or CompanyName() for full diagnostic logs
var
    CallStack: Text;
    ErrorData: ErrorInfo;
begin
    if not TryMyFunction() then begin
        GetLastError(ErrorData);
        LogToTable('Error: %1 - Stack: %2', ErrorData.Message, SessionInformation.Callstack());
    end;

SessionInformation.Callstack() is a small method with big potential. It’s the AL developer’s X-ray — revealing the path of execution in complex customizations or tangled logic.

Use it smartly, especially in:

  • Error handling routines
  • Long-running jobs
  • Telemetry and diagnostics pipelines

Stay Tuned for more updates

Calculate Values Only for Visible FlowFields in Business Central

FlowFields in Business Central are incredibly powerful, allowing you to dynamically calculate values based on related data. However, what happens when you have many FlowFields, but only a few are visible on a page? Calculating all of them can lead to unnecessary performance overhead. Business Central’s clever design allows you to optimize this process by calculating values only for visible FlowFields, significantly improving page load times and overall system responsiveness. Let’s delve into how this works and why it’s beneficial.

FlowFields retrieve data dynamically, often requiring complex calculations or lookups. While this provides real-time insights, it can also impact performance, especially when dealing with large datasets or numerous FlowFields.

Imagine a customer card page with dozens of FlowFields, but you only display a handful of them in the main view. Calculating all those FlowFields, even the hidden ones, wastes valuable resources. This is where Business Central’s “calculate only visible” feature comes into play.

The “Calculate Only Visible” Concept

Business Central intelligently determines which Flow Fields are currently visible on the page and only calculates those values. This optimization minimizes unnecessary computations, resulting in faster page loads and improved user experience.

Benefits of Calculating Only Visible FlowFields:

  • Improved Performance: Faster page load times, especially for pages with numerous FlowFields.
  • Enhanced User Experience: Smoother navigation and faster data retrieval.
  • Scalability: Allows you to design complex pages with many FlowFields without sacrificing performance.

Business Central’s runtime environment dynamically analyzes the page layout and determines which Flow Fields are currently displayed.

Business Central’s “calculate only visible FlowFields” feature is a powerful optimization that can significantly improve performance and user experience

Stay tuned for more.

Introduction of ‘Continue’ in Business Central v26

The Dynamics 365 Business Central ecosystem is in a state of continuous evolution, with each release bringing enhancements that empower developers and refine business processes. With the advent of version 26 (2025 release wave 1), a particularly noteworthy addition to the AL programming language is the continue statement. While seemingly a minor syntactic change, its implications for code efficiency and clarity are substantial.

A Refined Approach to Loop Control

In the realm of business application development, loops are indispensable. They facilitate iterative data processing, automation of repetitive tasks, and the implementation of complex algorithms. However, traditional loop structures often necessitate convoluted conditional logic to bypass specific iterations, leading to code that is both verbose and difficult to maintain.

The introduction of continue addresses this challenge directly. By providing a concise mechanism to skip the remaining code within a loop’s current iteration and proceed to the next, it promotes a more streamlined and readable coding style.

Benefits for Business Central Developers

  • Enhanced Code Readability: The continue statement reduces the reliance on nested IF statements, resulting in cleaner and more maintainable code. This is particularly crucial in large-scale Business Central implementations where code clarity is paramount.
  • Improved Performance: By bypassing unnecessary code execution, continue contributes to optimized loop performance. This is especially relevant when processing large datasets or executing computationally intensive operations.
  • Modernization of AL: The inclusion of continue aligns AL with contemporary programming paradigms, enhancing its usability for developers accustomed to other languages. It signifies changes to evolving AL into a more robust and versatile development platform.
  • Increased Development Flexibility: The ability to finely control loop execution grants developers increased flexibility when coding. This allows for more complex and efficient algorithms to be developed.

Where Can You Use ‘Continue’?

The continue statement is your ally within various loop structures in AL:

  • for loops: Ideal for iterating a specific number of times.
  • while loops: Perfect for looping until a condition is met.
  • repeat...until loops: Useful for executing a block of code at least once.
  • foreach loops: Designed for iterating through collections.

A Case in Point

Consider a scenario where a developer needs to process a batch of sales orders, excluding those with specific characteristics. Without continue, the code might involve nested IF statements to filter out unwanted orders. However, with continue, the logic becomes significantly more concise:

local procedure ProcessSalesOrders(SalesOrderRecord: Record "Sales Header")
begin
    SalesOrderRecord.Reset();
    SalesOrderRecord.FindSet();

    repeat
        if SalesOrderRecord."Order Type" = SalesOrderRecord."Order Type"::Quote then
            continue; // Skip quotes
        end;

        // Process the remaining sales order logic here
        // ...
    until SalesOrderRecord.Next() = 0;
end;

This example illustrates the power of continue in simplifying loop logic and enhancing code clarity.

Stay tuned for more.