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.

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.