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.

Business Central 2025 Wave 1 (BC26) – SetAutoCalcFields Method on RecordRef

Microsoft Dynamics 365 Business Central 2025 Wave 1 (version 26) introduces several enhancements to developer productivity and platform capabilities. One of the notable changes for AL developers is the new SetAutoCalcFields method added to the RecordRef data type.

This method brings the power of calculated flow fields to the RecordRef context, which previously lacked a built-in way to pre-calculate flow fields without manually invoking CALCFIELDS. Let’s explore what this update means, how it works, and how to use it effectively.

🧠 What is SetAutoCalcFields?

The SetAutoCalcFields method allows developers to specify which flow fields (calculated fields) should be automatically calculated when retrieving a record using the RecordRef data type.

This mimics the behavior of the SetAutoCalcFields method already available on the Record data type, extending it to scenarios where developers work with dynamic tables using RecordRef.

📘 Syntax:

RecordRef.SetAutoCalcFields(Field1, Field2, ...)

🛠️ Example

procedure DemoSetAutoCalcFields()
var
    RecRef: RecordRef;
    FieldRef: FieldRef;
    FieldRefAmount: FieldRef;
begin
    // Open the "Customer" table dynamically
    RecRef.Open(Database::Customer);

    // Get reference to the "Balance" flow field (Field No. = 21 in Customer)
    FieldRefAmount := RecRef.Field(21); 

    // Set the flow field to auto-calculate
    RecRef.SetAutoCalcFields(FieldRefAmount);

    // Find a record
    if RecRef.FindFirst() then begin
        // Now the "Balance" field will be auto-calculated
        Message('Customer Balance: %1', FieldRefAmount.Value);
    end;

    RecRef.Close();
end;

The introduction of the SetAutoCalcFields method on the RecordRef data type in Business Central 2025 Wave 1 is a welcome enhancement for developers. It provides a more efficient and streamlined way to work with AutoCalcFields when using RecordRef, leading to improved application performance and cleaner, more maintainable code.

Stay tuned for more.

File.ViewFromStream in AL: Display Text Directly from Stream

Microsoft Dynamics 365 Business Central 2025 Wave 1 continues to improve its developer experience with handy new features. One of the exciting additions in this release is the File.ViewFromStream method — a simple yet powerful function that enhances how developers interact with files stored in memory.

In the current versions of Business Central, when you need to view an attached document, a report output, or an incoming file, the typical process involves downloading the file first and then opening it with an external application. This can be time-consuming, especially when dealing with multiple files or when you simply need a quick glance at the content. Switching between applications disrupts your workflow and can feel inefficient.

📘 What is File.ViewFromStream?

The new method File.ViewFromStream(Stream: InStream,Text[,Boolean]) enables developers to open or preview a file directly from a stream, without having to save it to a temporary physical file.

This is a major convenience when working with files generated on the fly — such as PDFs, Excel files, or text reports — especially in scenarios where users just need to view or download the file rather than save it on the server.

Syntax

[Ok := ]  File.ViewFromStream(InStream: InStream, FileName: Text [, AllowDownloadAndPrint: Boolean])

🛠 Example:

procedure ShowGeneratedReport()
var
    TempBlob: Codeunit "Temp Blob";
    OutStream: OutStream;
    InStream: InStream;
    ReportContent: Text;
begin
    ReportContent := 'Hello from AL!' + Format(CurrentDateTime) + '\nThis is a preview of your text report.';

    TempBlob.CreateOutStream(OutStream);
    OutStream.WriteText(ReportContent);

    TempBlob.CreateInStream(InStream);
    File.ViewFromStream(InStream, 'ReportPreview.txt', true);
end;

💼 Use Cases

Here are some scenarios where ViewFromStream can be a game-changer:

  • Previewing customer invoices or sales reports generated on-demand.
  • Opening files attached in workflow approvals.
  • On-the-fly document generation in extensions or apps.

The File.ViewFromStream method offers a powerful and user-friendly way to present stream content directly within Dynamics 365 Business Central. The File.ViewFromStream method is a lightweight, client-friendly way to present text content on the fly in Business Central.

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

Using the New IncStr Overload in Business Central AL

With recent updates to AL language in Microsoft Dynamics 365 Business Central, developers now have more flexibility when working with strings containing numeric suffixes — thanks to the new overload of the IncStr method.

If you’ve ever had to increment a string with a number at the end (e.g., “INV001” to “INV002”), you’ve probably used IncStr. But until recently, IncStr only allowed an increment of +1.

Let’s explore how the new overload changes that.

🆕 What’s New in IncStr?

Traditionally, IncStr was used like this:

NewString := IncStr('INV001');  // Result: 'INV002'

Now, with the new overload, you can specify how much to increment by:

NewString := IncStr('INV001', 5);  // Result: 'INV006'

✅ Syntax:

IncStr(Value: String, IncrementBy: Integer): String

This enhancement is particularly useful in scenarios like:

  • Batch processing: Skipping ranges (e.g., test IDs, invoice numbers)
  • Custom logic: Implementing non-sequential numbering patterns
  • Looping identifiers: Where the next string isn’t always +1

⚙️ Example

LastCode := IncStr(LastCode, 5); // Jump by 5 in one go

🚧 Cases to Consider

  • It only increments the last numeric section of the string.
  • It respects the original number of digits (e.g., padding).
  • If there’s no number, it defaults to 1 and appends it.

IncStr('ABC', 3);  // Result: 'ABC3'

The new IncStr overload is a small change with big impact — making it easier to handle advanced string number incrementing without tedious code.

Stay Tuned for more.

Implicit Record and Record Ref Conversion in Business Central AL

When working with Microsoft Dynamics 365 Business Central, one of the most powerful capabilities is the dynamic handling of data using RecordRef. However, as a developer, you may have run into scenarios where you need to switch between the strongly typed Record and the flexible RecordRef—and wondered if there’s a clean way to do it.

Good news: Business Central now supports implicit conversion between Record and RecordRef

📘 Understanding the Core Types:

Before exploring the implicit conversion, it’s crucial to understand the distinct roles of Record and RecordRef:

  • Record: A strongly-typed variable that represents a specific table in the Business Central database. The compiler enforces type safety, ensuring that operations performed on a Record variable are valid for the defined table structure.
  • RecordRef: A more dynamic variable that provides a generic reference to any table in the Business Central database. It allows for runtime manipulation of table structures and data, often used in scenarios like generic data access, metadata exploration, and dynamic query building.

Implicit Conversion – What’s New?

With recent updates, AL now supports implicit conversion:

  • From a Record to a RecordRef
  • From a RecordRef back to a Record (if the types match)

This means cleaner, safer, and more readable code without the boilerplate RecordRef.GetTable() or RecordRef.SetTable().

🔍 Example: Record to RecordRef

procedure LogAnyRecord(rec: RecordRef)
begin
    Message('Table ID: %1', rec.Number);
end;

procedure RunLogging()
var
    customer: Record Customer;
begin
    customer.Get('10000');
    LogAnyRecord(customer); // Implicit conversion from Record to RecordRef
end;

No need for recRef.SetTable(customer) — it’s handled under the hood.

🔄 Example: RecordRef to Record

procedure GetCustomerName(recRef: RecordRef): Text
var
    customer: Record Customer;
begin
    customer := recRef; // Implicit conversion from RecordRef to Record
    exit(customer.Name);
end;

Implicit conversions between Record and RecordRef bring AL language making it easier to write dynamic yet type-safe code. While it’s a small feature on the surface, it greatly enhances developer productivity and code clarity.

Stay Tuned for more updates.

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.

Production Order Cancellations: Reversing Consumption in Business Central V26

Production orders are the backbone of manufacturing operations, but sometimes, plans change. Orders need to be cancelled, and when those orders have already consumed materials, things can get tricky. Business Central V26 has stepped in to simplify this process, offering a more streamlined way to reverse consumption and cancel production orders. Let’s explore how this works.

Imagine you’ve started a production order, materials have been consumed, and then, for whatever reason, the order needs to be scrapped. In previous versions of Business Central, simply deleting the order wasn’t an option. The system needed a way to accurately reverse the consumption entries to maintain inventory and financial integrity. This often involved manual adjustments and could be a time-consuming, error-prone process.

Business Central V26: Simplifying the Reversal:

Enter the “Reverse Production Order Transaction” action in Business Central V26. This feature provides a more efficient and accurate way to undo consumption and output transactions, making production order cancellations less of a headache.

How it Works:

  • Reversing Item Ledger Entries:
    • When you use the “Reverse Production Order Transaction” action, Business Central generates reversing item journal lines.
    • These lines effectively negate the original consumption entries, returning the materials to inventory.
  • Handling Output and Capacity:
    • The system also reverses output and capacity entries, including quantities, scrap, setup time, and run time.
    • This ensures that all related ledger entries are accurately adjusted.
  • Accurate Ledger Updates:
    • The system applies these reversals to the original ledger entries, maintaining precise inventory and cost records.

After reversal of production order you can finish production order without output. To achieve this you need to enable the setup on Manufacturing setup

Activate the Finish Order Without Output toggle in the Manufacturing Setup page.

Business Central V26’s enhanced capabilities for reversing production order transactions represent a significant step forward in simplifying production management. By automating the reversal process, manufacturers can save time, reduce errors, and maintain accurate inventory and financial records. This feature is a valuable addition to the Business Central , making production order cancellations less of a burden and more of a seamless operation.

Stay tuned for more updates.

Preview PDFs Directly in Business Central Web Client (v26)

With the release of version 26, a significant productivity boost has arrived: direct PDF attachment previews within the web client. No more downloading, opening external viewers, or switching between applications. This streamlined experience lets you access and review crucial documents instantly, right within your Business Central workflow.

What Does This Mean For You?

Imagine you’re processing a purchase order and need to quickly verify the attached vendor invoice. Previously, you’d have to download the PDF, open it in a separate application, and then return to Business Central. This process was time-consuming and disruptive.

Now, with the new preview functionality, you can:

  • View PDFs directly in the FactBox: When a PDF is attached to a record (like a sales order, purchase invoice, or customer card), you can preview it instantly in the FactBox without leaving the page.
  • Save time and improve efficiency: Eliminate the need for downloads and external viewers, allowing you to focus on your core tasks.
  • Enhance collaboration: Quickly share and review documents with colleagues, streamlining approvals and decision-making.
  • Enjoy a seamless user experience: The integrated preview functionality provides a more intuitive and efficient workflow.

How Does It Work?

The new feature leverages the browser’s built-in PDF rendering capabilities. When you click on a PDF attachment in the FactBox, the document opens directly within the Business Central web client, allowing you to:

  • Scroll through pages.
  • Zoom in and out.
  • Search for specific text.

This feature is enabled by default in Business Central version 26. Simply open a record with a PDF attachment, and you’ll see the preview option in the FactBox.

For Developers:

  • Microsoft has added the following AL methods to enable this functionality.
    • File.ViewFromStream (for Business Central online)
    • File.View (for Business Central on-premises)