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

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)

Reopening Finished Production Orders in Business Central v26 (Wave 1 2025)

Microsoft Business Central is constantly evolving, bringing us new features and enhancements with each wave release. One highly anticipated addition in Wave 1 2025 (v26) is the ability to reopen finished production orders. This seemingly simple functionality addresses a long-standing pain point for many manufacturers, offering increased flexibility and control over their production processes.

The Challenge

Previously, once a production order was marked as “Finished,” it was essentially locked. Any necessary adjustments, corrections, or further processing required creating a new production order, leading to potential data discrepancies and cumbersome workarounds. This rigid approach often hindered efficient handling of rework, returns, or unexpected post-production requirements.

The Solution: Reopening Finished Orders

With the v26 update, Business Central introduces the capability to reopen finished production orders.

To reopen a production order, follow these steps:

  1. On the Finished Production Orders page, select the order you want to edit.
  2. Choose the Reopen action.
  3. In the Do you want to reopen the production order? confirmation dialog, choose Yes.

This empowers users to:

  • Correct Errors: If errors are discovered after finishing an order (e.g., incorrect quantity reporting, wrong item consumption), you can reopen the order, make the necessary adjustments, and re-finish it.
  • Handle Rework or Returns: If products need rework or are returned, you can reopen the finished order, register the required adjustments, and complete the rework process within the original order.
  • Add Post-Production Activities: If additional operations or processes are needed after the order is finished (e.g., special packaging, additional quality checks), you can reopen the order and register these activities.
  • Maintain Data Integrity: Reopening the original order ensures a consistent and accurate audit trail, preventing data fragmentation and improving reporting accuracy.

As we approach the release of Wave 1 2025, stay tuned for more detailed information and practical examples on how to leverage this valuable feature.

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.

Unleash Your Workspace: Resizable Fact Boxes Arrive in Business Central v26!

Tired of cramped Fact Boxes? Wishing you could see more detail without endless scrolling? Your wish has been granted! Dynamics 365 Business Central version 26 (2025 wave 1) introduces a much-anticipated feature: resizable Fact Boxes!

For years, Business Central users have navigated valuable contextual information within the FactBox pane. However, the fixed width often led to limitations, especially on larger screens or when dealing with detailed data. Now, Microsoft has empowered users to take control of their workspace.

Say Goodbye to Fixed Dimensions!

With the new resizing capability, you can:

  • Customize Your View: Easily adjust the width of the FactBox pane to suit your needs. Whether you need a narrow view for quick glances or a wider view for in-depth analysis, the choice is yours.
  • Maximize Screen Real Estate: Utilize your screen’s potential by expanding the FactBox to view more information at once. No more unnecessary scrolling!
  • Personalized Experience: Business Central remembers your preferred FactBox size per page and mode, ensuring a consistent and tailored experience every time you return.
  • Simple and Intuitive: Resizing is a breeze! Simply drag the divider line between the main page area and the FactBox pane to your desired width.
  • Quick Reset: If you want to return to the default size, just double-click the divider line.
  • Reasonable Limits: The factbox can be expanded to a maximum of half of the page width.

Why This Matters

This seemingly small change has a significant impact on user productivity and efficiency. By providing greater control over the workspace, Business Central empowers users to:

  • View Information More Effectively: Gain a clearer and more comprehensive understanding of related data.
  • Reduce Scrolling and Save Time: Access crucial information faster and streamline workflows.
  • Enhance User Experience: Create a more personalized and comfortable working environment.

How to Resize Your Fact Box:

  1. Locate the divider line separating the main page area and the FactBox pane.
  2. Click and drag the divider line to your desired width.
  3. Observe the FactBox pane resizing accordingly.
  4. To return to the default size, double-click the divider line.

Looking Ahead

The introduction of resizable Fact Boxes highlights continuous improvement and user-centric design. This feature further enhances the flexibility and usability of Business Central, making it an even more powerful tool for businesses of all sizes.

Enhancing User Experience with InstructionalText Property in Microsoft Dynamics 365 Business Central

In today’s fast-paced business environment, clear and efficient communication within ERP systems is essential. Microsoft Dynamics 365 Business Central offers a plethora of features to enhance user experience, one of which is the InstructionalText property. This seemingly simple feature can significantly improve the usability and clarity of forms and pages in Business Central. Let’s dive into what the InstructionalText property is, how it works, and best practices for using it effectively.

What is the InstructionalText Property?

The InstructionalText property in Business Central is a text property used to provide users with additional guidance or instructions on how to fill out fields, use pages, or complete specific tasks within the system. This text appears within the field, making it easier for users to understand what is expected of them without needing to consult external documentation or manuals.

Where Can You Use InstructionalText?

The InstructionalText property can be applied to various elements within Business Central, such as:

  • Fields: Provide specific instructions on what data is required.
  • Pages & Page Extension: Offer guidance on the overall use of the page.

Benefits of Using InstructionalText

  1. Enhanced Usability: Users can quickly understand the purpose and requirements of fields and actions.
  2. Reduced Training Time: New users can become proficient more quickly with on-screen guidance.
  3. Consistency: Standardizes instructions across the system, reducing errors and confusion.
  4. Improved Data Quality: Ensures users input data correctly by providing specific instructions.

How to Implement InstructionalText

Implementing the InstructionalText property in Business Central is straightforward. Here’s a step-by-step guide:

  1. Open AL Code: Open your AL code project in Visual Studio Code.
  2. Define the Property: Locate the field on page where you want to add the instructional text and define the InstructionalText property. For example:
field("Customer Name"; "Name")
{
    InstructionalText = 'Enter the full name of the customer. This is a required field.';
}

Best Practices for Using InstructionalText

To make the most out of the InstructionalText property, consider the following best practices:

  1. Be Clear and Concise: Instructional text should be straightforward and easy to understand. Avoid jargon and keep it short.
  2. Be Specific: Provide precise instructions on what is required. For instance, instead of “Enter the name,” use “Enter the full legal name of the customer.”
  3. Prioritize Important Fields: Use instructional text for fields and actions that are critical to business processes or where users frequently make errors.
  4. Consistency is Key: Ensure that similar fields across different pages have consistent instructional text to avoid confusion.
  5. Use Plain Language: Write instructional text in a way that is accessible to all users, regardless of their technical expertise.

The InstructionalText property in Business Central is a powerful feature that can significantly enhance the user experience. By providing clear, concise, and consistent instructions directly within the system, you can reduce errors, improve data quality, and streamline onboarding for new users.

Hope you will find this helpful.