Study guide

11.3 Data Process Model & Posting Routine Architecture

Microsoft Dynamics 365 Business Central Developer MB-820

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Business Central Architecture & Platform Foundation

1.1 Business Central Architecture & Extensions Model 1.2 Customization Lifecycle: Cloud (SaaS) vs. On-Premises 1.3 Base Application, System Application & AppSource

2 Chapter 2: Development Environment & Configuration

2.1: Development Environment Setup: VS Code, AL: Go! Projects & Sandboxes 2.2: AL Configuration Files: app.json & launch.json Parameters 2.3: Multi-Root Workspaces & Project Dependencies

3 Chapter 3: Extension Lifecycle: Debugging, Deployment, Multilanguage & Maintenance

3.1 Debugging & Snapshot Debugging in Visual Studio Code 3.2 Extension Deployment & Schema Synchronization Modes 3.3 Multilanguage Development with XLIFF & Translation Files 3.4 Extension Maintenance, Deprecation & Breaking Changes

4 Chapter 4: Tables, Table Extensions & Data Modeling

4.1: Building Tables, Fields, Keys & Data Types 4.2: Table Extensions & Table Modifications 4.3: FlowFields, FlowFilters & Table Relations 4.4: Enums, Enum Extensions & Extensible Types

5 Chapter 5: Pages, Page Extensions & Role Centers

5.1: Page Types, Anatomy & Control Structure 5.2: Building Card, List & Document Pages 5.3: Page Extensions & Page Customizations 5.4: Role Centers, Headlines & Cue Data Modeling

6 Chapter 6: Reports & Document Generation

6.1 Report Architecture, DataItems & Dataset Design 6.2 Report Layouts: RDLC, Word, Excel & Multilanguage 6.3 Document Reports & Request Page Programming 6.4 Processing-Only Reports & Report Substitutions

7 Chapter 7: XMLports & Data Exchange

7.1 XMLport Architecture, Formats & Properties 7.2 XMLport Node Hierarchy, Triggers & Stream Manipulation

8 Chapter 8: Codeunits, Events, Triggers & Interfaces

8.1 Codeunit Types, Execution & SingleInstance Codeunits 8.2 Events, Publishers, Subscribers & Event Isolation 8.3 Interfaces, Polymorphism & Dynamic Codeunit Invocation 8.4 Installation & Upgrade Codeunits, Data Transfer & Archive

9 Chapter 9: Entitlements, Permissions & Queries

9.1 Permission Sets & Permission Set Extensions 9.2 Inherent Permissions, Inherent Entitlements & Security Scoping 9.3 Query Objects: Joins, Aggregation & Query as Report Data Source

10 Chapter 10: UI Customization, User Assistance & Onboarding

10.1 Profile Objects & Custom Page Views in AL 10.2 User Assistance: ToolTips, Teaching Tips & In-App Tours 10.3 Assisted Setup, Guided Experience & Onboarding Checklists

11 Chapter 11: Business Central Design Patterns & Data Process Model

11.1 Functional Table Types: Master Data, Supplemental & Setup Patterns 11.2 Document Standards: Header, Line, History & Journal Architectures 11.3 Data Process Model & Posting Routine Architecture

12 Chapter 12: AL Language Fundamentals, Data Types & Variables

12.1 AL Syntax, Variable Scope, Primitive & Complex Data Types 12.2 Expressions, Control Flow Statements & Built-in Functions 12.3 Access Modifiers (Public, Internal, Local) & Code Scoping

13 Chapter 13: Data Manipulation, Streams & Error Handling

13.1 Record Operations: Get, FindSet, ModifyAll & Filter Functions 13.2 Streams, File Management & TempBlob 13.3 Error Handling: ErrorInfo, TryFunctions & Collectible Errors

14 Chapter 14: Testing, Test Toolkit & Automation

14.1 Testing Architecture & the Test Toolkit 14.2 Authoring Test Codeunits & UI Handler Functions

15 Chapter 15: Telemetry, Performance Optimization & Analyzers

15.1 Telemetry Configuration & Azure Application Insights 15.2 Custom Telemetry Signals with Session.LogMessage & KQL 15.3 Performance Profiler, SetLoadFields & Query Optimization 15.4 AL Analyzers: CodeCop, AppSourceCop, UICop & PTECop

16 Chapter 16: REST Web Services & JSON in AL

16.1 HttpClient, HttpRequestMessage & REST API Consumption 16.2 JSON Processing: JsonObject, JsonArray, JsonValue & JsonToken

17 Chapter 17: API Pages, OData, Read Scale-Out & OAuth

17.1 API Pages (PageType=API), OData Web Services & REST Endpoints 17.2 Bound and Unbound OData Actions with [ServiceEnabled] 17.3 Read Scale-Out Architecture & DataAccessIntent Configuration 17.4 Microsoft Entra ID App Registrations & OAuth 2.0 Integration

11.3 Data Process Model & Posting Routine Architecture

Key Takeaways Explain This Topic AI

Business Central's posting architecture follows a decoupled three-tier pattern: Check routines (validation), Post Line routines (atomic ledger creation), and Post-Batch / Document Post routines (orchestration).

Codeunit 11 ('Gen. Jnl.-Check Line') validates financial rules, date posting ranges, dimensions, and balancing before any ledger modification begins.

Codeunit 12 ('Gen. Jnl.-Post Line') serves as the core atomic posting engine, responsible for creating G/L entries, subledgers (Customer, Vendor, Bank, VAT), detailed ledger records, and G/L Registers.

Posting Preview (Codeunit 19 'Gen. Jnl.-Post Preview') executes posting routines within an isolated rollback transaction, populating temporary ledger buffers for user inspection without committing database changes.

Last updated: August 2026

11.3 Data Process Model & Posting Routine Architecture

The posting pipeline is the computational heart of Microsoft Dynamics 365 Business Central. It is the engine that transforms transient transactional documents and staging journals into immutable, audited general ledger entries, subledger entries, item value entries, and register records. For the MB-820 exam, developers must master the Check -> Post -> Post-Batch architectural pattern, understand the division of responsibilities across core posting codeunits, and comprehend transaction consistency, in-memory temporary buffering, and the Posting Preview engine.

1. The Core Posting Architecture: Check -> Post Line -> Orchestrator

To ensure maintainability, scalability, and code reuse, Business Central decouples the posting pipeline into three discrete functional layers: +-----------------------------------------------------------------------------------------+

  • | THE POSTING PIPELINE |
  • +-----------------------------------------------------------------------------------------+
  • 1. CHECK TIER (Validation) ──▶ Codeunit 11 ("Gen. Jnl.-Check Line")
  • Validates dates, accounts, Codeunit 21 ("Item Jnl.-Check Line")
  • dimensions, and balances. Codeunit 242 ("Item Jnl.-Check Line")
  • 2. POST-LINE TIER (Atomic Ledger)──▶ Codeunit 12 ("Gen. Jnl.-Post Line")
  • Creates G/L, Cust, Vend, Bank, Codeunit 22 ("Item Jnl.-Post Line")
  • VAT Entries & G/L Register. Codeunit 23 ("FA Jnl.-Post Line")
  • 3. ORCHESTRATION TIER (Documents)──▶ Codeunit 80 ("Sales-Post")
  • Stages buffers, creates posted Codeunit 90 ("Purch.-Post")
  • invoices/shipments, calls C12/C22. Codeunit 231 ("Gen. Jnl.-Post Batch")

Why Posting is Decoupled:

Reusability: Whether a general ledger transaction originates from an interactive General Journal page, an automated payroll API, a Sales Invoice posting ( Sales-Post ), or a Bank Reconciliation, it passes through the identical atomic posting engine: Codeunit 12 "Gen. Jnl.-Post Line" .

Fail-Fast Validation: The Check tier ( Codeunit 11 ) executes all business and accounting validations before any physical database inserts occur, preventing partial posting failures.

Transaction Encapsulation: The entire pipeline executes inside a single ACID-compliant database transaction. If an error occurs on line 50 of a 100-line invoice, SQL Server rolls back all modifications, preventing database corruption.

Loading diagram... Business Central Posting Pipeline & Ledger Generation Flow

  • 2. Core Posting Codeunits Deep Dive
  • Codeunit 11: Gen. Jnl.-Check Line

Gen. Jnl.-Check Line validates individual Gen. Journal Line records before posting. It executes the following critical checks:

Posting Date Validation: Verifies that "Posting Date" falls within the allowed date range defined in General Ledger Setup ( Allow Posting From / Allow Posting To ) and overridden in User Setup for the active user.

Account Validation: Verifies the "Account No." exists, is not Blocked , and has "Direct Posting" = true (if posted directly from a journal rather than a subledger).

Dimension Verification: Invokes DimensionManagement.CheckDimComb to confirm that table-level dimension combinations and dimension value posting rules ( Code Mandatory , Same Code , No Code ) are satisfied.

Balance & Currency Checks: Verifies foreign exchange rates, ensures currency factors are valid, and checks whether balancing accounts ( "Bal. Account No." ) are correctly defined.

Codeunit 12: Gen. Jnl.-Post Line

Gen. Jnl.-Post Line is the central transaction engine of Business Central. It operates as an atomic processor:

G/L Entry Creation (Table 17): Inserts debit and credit G/L Entry records with sequential "Entry No." values, inheriting the line's Dimension Set ID .

Subledger Posting: If "Account Type" is Customer , Vendor , or Bank Account , it creates corresponding subledger records ( Cust. Ledger Entry , Vendor Ledger Entry , Bank Account Ledger Entry ).

Detailed Subledger Records: Inserts Detailed Cust. Ledg. Entry (Table 379) or Detailed Vendor Ledg. Entry (Table 380) records to track initial amounts, unrealized/realized currency gains and losses, and application history.

VAT Calculation & Entries (Table 254): Calculates unrealized and realized sales/purchase tax, inserting VAT Entry records.

Register Maintenance (Table 45 G/L Register ): Opens a new G/L Register record on the first line of a transaction, tracks the starting "From Entry No." , and updates "To Entry No." upon transaction completion.

Codeunit 80: Sales-Post (Document Orchestrator)

Sales-Post coordinates the complex multi-table posting of sales documents:

Initial Validation: Verifies lines, quantities to ship/invoice, warehouse handling, and customer credit limits.

Posted Document Headers/Lines: Inserts immutable posted document records ( Sales Shipment Header/Line , Sales Invoice Header/Line , Sales Cr.Memo Header/Line ).

Inventory Dispatch: Builds Item Journal Line buffers and calls Codeunit 22 "Item Jnl.-Post Line" to decrement inventory and create Item Ledger Entry and Value Entry records.

G/L & Subledger Dispatch: Builds temporary Gen. Journal Line records and calls Codeunit 12 "Gen. Jnl.-Post Line" for revenue, accounts receivable, and tax posting.

Cleanup / Archiving: Deletes invoiced lines from Sales Line and Sales Header (or decrements "Quantity Shipped" / "Quantity Invoiced" for partial postings) and automatically archives the final document if configured.

3. In-Memory Temporary Tables & Performance Buffering

Posting routines stage data in memory using temporary record buffers before committing physical records to the database tier.

Mechanics of Record.IsTemporary()

Declaring a record variable with var TempGenJnlLine: Record "Gen. Journal Line" temporary; (or calling TempRecord.Reset(); TempRecord.DeleteAll(); on temporary instances) instantiates the table buffer exclusively in Navision Server Tier (NST) RAM.

No SQL Round-Trips: Operations such as TempRecord.Insert() , TempRecord.Modify() , and TempRecord.FindSet() execute in server memory without generating SQL TDS network traffic or table locks.

Summing and Grouping: Posting routines accumulate tax amounts across lines by inserting records into TempVATAmountLine (Table 290). The code executes TempVATAmountLine.Get() or sums values in memory, and then generates consolidated G/L posting lines per VAT identifier. // Example of in-memory buffering pattern used during posting orchestration

  • procedure PostInvoiceRounding(var SalesHeader: Record "Sales Header"; TotalAmount: Decimal)
  • var
  • TempGenJnlLine: Record "Gen. Journal Line" temporary;
  • GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line";
  • LineNumber: Integer;
  • begin
  • LineNumber += 10000;
  • TempGenJnlLine.Init();
  • TempGenJnlLine."Line No." := LineNumber;
  • TempGenJnlLine."Document Type" := TempGenJnlLine."Document Type"::Invoice;
  • TempGenJnlLine."Document No." := SalesHeader."No.";
  • TempGenJnlLine."Posting Date" := SalesHeader."Posting Date";
  • TempGenJnlLine."Account Type" := TempGenJnlLine."Account Type"::"G/L Account";
  • TempGenJnlLine."Account No." := SalesHeader."Invoice Rounding Account";
  • TempGenJnlLine.Amount := TotalAmount;
  • TempGenJnlLine."Dimension Set ID" := SalesHeader."Dimension Set ID";
  • TempGenJnlLine.Insert(); // Staged in NST memory
  • // Dispatch buffered temporary line to atomic posting engine
  • GenJnlPostLine.RunWithCheck(TempGenJnlLine);
  • end;
  • 4. Transaction Consistency, Commit Rules & Posting Preview
  • Transaction Consistency & The Explicit Commit Ban

In Business Central, database transactions are ACID compliant. A transaction begins implicitly upon the first write operation ( Insert , Modify , Delete , LockTable ) and commits when execution finishes without error.

Strict Ban on Explicit Commit : Posting routines must never execute an explicit Commit() statement midway through posting. If a Commit were executed and a subsequent validation failed, the database would be left in an inconsistent, half-posted state with orphaned G/L or inventory entries.

Error Rollback: If an unhandled error occurs (e.g., Error(ValidationErr) or TestField failure), the platform automatically issues a SQL rollback, unwinding all modifications across all tables made during that transaction.

The Posting Preview Architecture ( Codeunit 19 )

The Posting Preview feature allows users to inspect all G/L entries, VAT entries, Customer ledger entries, and Item ledger entries that would be generated prior to committing an actual post. [ User clicks 'Preview Posting' ]

  • │
  • ▼
  • [ Codeunit 19 "Gen. Jnl.-Post Preview" initiates isolated background run ]
  • │
  • ▼
  • [ Event Subscribers intercept C12 / C22 inserts and write to Temporary Tables ]
  • │
  • ▼
  • [ Codeunit 19 throws controlled runtime Exception to force complete SQL Rollback ]
  • │
  • ▼
  • [ UI displays populated Temporary Ledger Tables in Posting Preview Page ]

Preview Mode Flag: Codeunit 19 "Gen. Jnl.-Post Preview" sets a global flag ( PreviewMode := true ) and executes the posting routine inside an isolated error-trapping scope.

Event Interception: Event subscribers in preview collector codeunits listen to OnAfterInsert... events in Codeunit 12 and Codeunit 22 . Instead of inserting physical records to SQL, they copy the records into session temporary record buffers ( TempGLEntry , TempCustLedgEntry , etc.).

Controlled Rollback: At the conclusion of the posting routine, Gen. Jnl.-Post Preview throws a special internal platform exception ( PostPreviewException ) that forces SQL Server to roll back the entire transaction completely.

UI Presentation: The temporary ledger buffers collected in memory are passed to the Posting Preview page, allowing the user to drill down into simulated accounting entries without altering physical database records.