Business Central SaaS Extension Design: Implementing Plant Tracking with AL Event Subscribers
Premanath Kumarage · Author
·7 min read
In many manufacturing and service-oriented organizations, sales transactions need to be associated with a Plant (or operational unit).
In this article▾
Extending Business Central SaaS: Plant Tracking Using AL Extensions
1️⃣ Problem Statement
In many manufacturing and service-oriented organizations, sales transactions need to be associated with a Plant (or operational unit).
Out of the box, Microsoft Dynamics 365 Business Central SaaS does not provide a standard Plant dimension on Sales documents that automatically flows through:
Sales Orders
Posted Sales Shipments
Posted Sales Invoices
Customer Ledger Entries
Challenges
No standard Plant master table
No Plant selection on Sales Orders
No automatic propagation during posting
SaaS environment prohibits base object modification
MicroCloud360 needed a clean, upgrade-safe, SaaS-compliant extension to address this requirement.
2️⃣ Functional Requirements
FR-01: Plant Master
Maintain a list of Plants
Each Plant contains:
Plant Id (uppercase, unique)
Plant Name
FR-02: Sales Order Integration
Add Plant Id field to Sales Order header
Field must be optional
Users can select only valid Plant Ids (dropdown lookup)
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post",
'OnAfterInsertInvoiceHeader', '', false, false)]
local procedure OnAfterInsertInvoiceHeader(
var SalesHeader: Record "Sales Header";
var SalesInvHeader: Record "Sales Invoice Header")
begin
if SalesHeader."Plant Id" <> '' then
SalesInvHeader."Plant Id" := SalesHeader."Plant Id";
end;
pageextension 50501 "MC360 Cust. Ledger Entries Ext" extends "Customer Ledger Entries"
{
layout
{
// In standard objects this is usually the repeater control name.
// If your symbols show a different repeater/container name, replace Control1 accordingly.
addlast(Control1)
{
field("Plant Id"; Rec."Plant Id")
{
ApplicationArea = All;
ToolTip = 'Shows the Plant Id carried from the originating sales document.';
}
}
}
}
Here’s a battle-tested, simple structure for one repo hosting many Business Central extensions, plus a clean naming/ID/range/versioning standard that won’t hurt you later when you add CI/CD.
Below is a clear, side-by-side comparison of NAV NAS vs Business Central Job Queue, written in plain language, plus a visual flow diagram you can embed in your blog. This is ideal for developers and consultants transitioning from NAV to Business Central.
·Business Central
Start here
Every piece here started as a client problem. Tell us yours.
A working session, not a sales call. Bring the process your current system fights you on, and we will tell you plainly what it would take to fix it.
Stay ahead with Microsoft Business Applications. Insights, implementation advice and practical ideas to help your business get more from Microsoft technology.
By subscribing, you acknowledge MicroCloud 360’s Privacy Policy.