---
id: object/codeunit/20
type: object
title: Codeunit 20 "Posting Preview Event Handler"
summary: Codeunit 20 "Posting Preview Event Handler" in Base Application (Microsoft.Finance.GeneralLedger.Preview). 7 public procedures, 22 events, 41 event subscribers. Present since at least BC23, still in BC30, changed in BC25-26, BC29.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "29"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 58ec5554f298bb54b2ec329a31c43f140a65a2cce663b50c8a538defc595a4d3
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/GeneralLedger/Preview/PostingPreviewEventHandler.Codeunit.al
    title: src/Layers/W1/BaseApp/Finance/GeneralLedger/Preview/PostingPreviewEventHandler.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/au
    - localization/nz
    - localization/ru
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9067
    - change/bcapps/9391
object_type: codeunit
object_id: 20
name: Posting Preview Event Handler
namespace: Microsoft.Finance.GeneralLedger.Preview
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "25"
  - "26"
  - "29"
source_major: "29"
obsolete: null
countries:
  - au
  - nz
  - ru
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 70
  events: 22
  subscribers: 41
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 19
  calls: 15
  called_by: 12
  implements: 0
---

# Codeunit 20 "Posting Preview Event Handler"

> Codeunit 20 "Posting Preview Event Handler" in Base Application (Microsoft.Finance.GeneralLedger.Preview). 7 public procedures, 22 events, 41 event subscribers. Present since at least BC23, still in BC30, changed in BC25-26, BC29.

Base Application · Microsoft.Finance.GeneralLedger.Preview · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/GeneralLedger/Preview/PostingPreviewEventHandler.Codeunit.al) · facts from BC29

## Events published

- `OnAfterFillDocumentEntry(var DocumentEntry: Record "Document Entry")` (integration): Raised after a document entry is populated during preview processing. Allows customization of document entry data for preview display.
  - subscribers: [Codeunit 20566 "Subc. Posting Preview Subscr."](../codeunit/20566.md) FillDocumentEntryOnAfterFillDocumentEntry, [Codeunit 6226 "Sust. Preview Post. Subscriber"](../codeunit/6226.md) OnAfterFillDocumentEntry, [Codeunit 6498 "Serv. Posting Preview Subscr."](../codeunit/6498.md) FillDocumentEntryOnAfterFillDocumentEntry, [Codeunit 6792 "Wthldg Tax Preview Handler"](../codeunit/6792.md) FillWithholdingTaxEntries, [Codeunit 6995 "Exp. Preview Post. Subscriber"](../codeunit/6995.md) OnAfterFillDocumentEntry, [Codeunit 8078 "Deferral Post. Preview Subscr."](../codeunit/8078.md) FillDocumentEntryOnAfterFillDocumentEntry, [Codeunit 99000798 "Mfg. Posting Preview Subscr."](../codeunit/99000798.md) FillDocumentEntryOnAfterFillDocumentEntry
- `OnGetEntries(TableNo: Integer; var RecRef: RecordRef)` (integration): Raised when retrieving preview entries for a specific table during preview processing. Allows customization of which entries are included in preview display.
  - subscribers: [Codeunit 20566 "Subc. Posting Preview Subscr."](../codeunit/20566.md) GetEntriesOnGetEntries, [Codeunit 6498 "Serv. Posting Preview Subscr."](../codeunit/6498.md) GetEntriesOnGetEntries, [Codeunit 6792 "Wthldg Tax Preview Handler"](../codeunit/6792.md) WithholdingTaxEntry, [Codeunit 8078 "Deferral Post. Preview Subscr."](../codeunit/8078.md) GetEntriesOnGetEntries, [Codeunit 99000798 "Mfg. Posting Preview Subscr."](../codeunit/99000798.md) GetEntriesOnGetEntries
- `OnAfterShowEntries(TableNo: Integer)` (integration): Raised after preview entries have been displayed for a specific table. Allows post-display processing and cleanup for custom preview entries.
  - subscribers: [Codeunit 20566 "Subc. Posting Preview Subscr."](../codeunit/20566.md) ShowEntriesOnAfterShowEntries, [Codeunit 6226 "Sust. Preview Post. Subscriber"](../codeunit/6226.md) OnAfterShowEntries, [Codeunit 6498 "Serv. Posting Preview Subscr."](../codeunit/6498.md) ShowEntriesOnAfterShowEntries, [Codeunit 6792 "Wthldg Tax Preview Handler"](../codeunit/6792.md) WithholdingTaxShowEntries, [Codeunit 6995 "Exp. Preview Post. Subscriber"](../codeunit/6995.md) OnAfterShowEntries, [Codeunit 8078 "Deferral Post. Preview Subscr."](../codeunit/8078.md) ShowEntriesOnAfterShowEntries, [Codeunit 99000798 "Mfg. Posting Preview Subscr."](../codeunit/99000798.md) ShowEntriesOnAfterShowEntries
- `OnBeforeModifyTempGLEntry(var Rec: Record "G/L Entry"; var TempCustLedgerEntry: Record "G/L Entry")` (integration): Raised before modifying a temporary G/L Entry record during preview processing. Allows customization of G/L entry data before it's stored in the preview cache.
- `OnBeforeModifyTempCustLedgEntry(var Rec: Record "Cust. Ledger Entry"; var TempCustLedgerEntry: Record "Cust. Ledger Entry")` (integration): Raised before modifying a temporary Customer Ledger Entry record during preview processing. Allows customization of customer ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempDtldCustLedgEntry(var Rec: Record "Detailed Cust. Ledg. Entry"; var TempCustLedgerEntry: Record "Detailed Cust. Ledg. Entry")` (integration): Raised before modifying a temporary Detailed Customer Ledger Entry record during preview processing. Allows customization of detailed customer ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempVendLedgEntry(var Rec: Record "Vendor Ledger Entry"; var TempVendLedgerEntry: Record "Vendor Ledger Entry")` (integration): Raised before modifying a temporary Vendor Ledger Entry record during preview processing. Allows customization of vendor ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempDtldVendLedgEntry(var Rec: Record "Detailed Vendor Ledg. Entry"; var TempVendLedgerEntry: Record "Detailed Vendor Ledg. Entry")` (integration): Raised before modifying a temporary Detailed Vendor Ledger Entry record during preview processing. Allows customization of detailed vendor ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempVATEntry(var Rec: Record "VAT Entry"; var TempVATEntry: Record "VAT Entry")` (integration): Raised before modifying a temporary VAT Entry record during preview processing. Allows customization of VAT entry data before it's stored in the preview cache.
- `OnBeforeModifyTempValueEntry(var Rec: Record "Value Entry"; var TempValueEntry: Record "Value Entry")` (integration): Raised before modifying a temporary Value Entry record during preview processing. Allows customization of value entry data before it's stored in the preview cache.
- `OnBeforeModifyTempItemLedgerEntry(var Rec: Record "Item Ledger Entry"; var TempItemLedgerEntry: Record "Item Ledger Entry")` (integration): Raised before modifying a temporary Item Ledger Entry record during preview processing. Allows customization of item ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempFALedgEntry(var Rec: Record "FA Ledger Entry"; var TempFALedgEntry: Record "FA Ledger Entry")` (integration): Raised before modifying a temporary Fixed Asset Ledger Entry record during preview processing. Allows customization of FA ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempEmplLedgEntry(var Rec: Record "Employee Ledger Entry"; var TempEmplLedgEntry: Record "Employee Ledger Entry")` (integration): Raised before modifying a temporary Employee Ledger Entry record during preview processing. Allows customization of employee ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempBankAccLedgerEntry(var Rec: Record "Bank Account Ledger Entry"; var TempBankAccLedgerEntry: Record "Bank Account Ledger Entry")` (integration): Raised before modifying a temporary Bank Account Ledger Entry record during preview processing. Allows customization of bank account ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempResLedgerEntry(var Rec: Record "Res. Ledger Entry"; var TempResLedgerEntry: Record "Res. Ledger Entry")` (integration): Raised before modifying a temporary Resource Ledger Entry record during preview processing. Allows customization of resource ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempMaintenanceLedgerEntry(var Rec: Record "Maintenance Ledger Entry"; var TempMaintenanceLedgerEntry: Record "Maintenance Ledger Entry")` (integration): Raised before modifying a temporary Maintenance Ledger Entry record during preview processing. Allows customization of maintenance ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempJobLedgerEntry(var Rec: Record "Job Ledger Entry"; var TempJobLedgerEntry: Record "Job Ledger Entry")` (integration): Raised before modifying a temporary Job Ledger Entry record during preview processing. Allows customization of job ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempExchRateAdjmtLedgEntry(var Rec: Record "Exch. Rate Adjmt. Ledg. Entry"; var TempExchRateAdjmtLedgEntry: Record "Exch. Rate Adjmt. Ledg. Entry")` (integration): Raised before modifying a temporary Exchange Rate Adjustment Ledger Entry record during preview processing. Allows customization of exchange rate adjustment entry data before it's stored in the preview cache.
- `OnBeforeModifyTempWarehouseEntry(var Rec: Record "Warehouse Entry"; var TempWarehouseEntry: Record "Warehouse Entry")` (integration): Raised before modifying a temporary Warehouse Entry record during preview processing. Allows customization of warehouse entry data before it's stored in the preview cache.
- `OnBeforeModifyTempPhysInventoryLedgerEntry(var Rec: Record "Phys. Inventory Ledger Entry"; var TempPhysInventoryLedgerEntry: Record "Phys. Inventory Ledger Entry")` (integration): Raised before modifying a temporary Physical Inventory Ledger Entry record during preview processing. Allows customization of physical inventory entry data before it's stored in the preview cache.
- `OnBeforeModifyTempDtldEmplLedgEntry(var Rec: Record "Detailed Employee Ledger Entry"; var TempDtldEmplLedgEntry: Record "Detailed Employee Ledger Entry" temporary)` (integration): Raised before modifying a temporary Detailed Employee Ledger Entry record during preview processing. Allows customization of detailed employee ledger entry data before it's stored in the preview cache.
- `OnBeforeModifyTempSpendRequestToGLEntryLink(var Rec: Record "Spend Request To G/L Link"; var TempSpendRequestToGLEntryLink: Record "Spend Request To G/L Link")` (integration)

## Event subscriptions

- OnInsertGLEntry subscribes to Table "G/L Entry" OnAfterInsertEvent
- OnModifyGLEntry subscribes to Table "G/L Entry" OnAfterModifyEvent
- OnInsertVATEntry subscribes to Table "VAT Entry" OnAfterInsertEvent
- OnModifyVATEntry subscribes to Table "VAT Entry" OnAfterModifyEvent
- OnInsertValueEntry subscribes to Table "Value Entry" OnAfterInsertEvent
- OnModifyValueEntry subscribes to Table "Value Entry" OnAfterModifyEvent
- OnInsertItemLedgerEntry subscribes to Table "Item Ledger Entry" OnAfterInsertEvent
- OnModifyItemLedgerEntry subscribes to Table "Item Ledger Entry" OnAfterModifyEvent
- OnInsertFALedgEntry subscribes to Table "FA Ledger Entry" OnAfterInsertEvent
- OnModifyFALedgEntry subscribes to Table "FA Ledger Entry" OnAfterModifyEvent
- OnInsertCustLedgerEntry subscribes to Table "Cust. Ledger Entry" OnAfterInsertEvent
- OnModifyCustLedgerEntry subscribes to Table "Cust. Ledger Entry" OnAfterModifyEvent
- OnInsertDetailedCustLedgEntry subscribes to Table "Detailed Cust. Ledg. Entry" OnAfterInsertEvent
- OnModifyDetailedCustLedgerEntry subscribes to Table "Detailed Cust. Ledg. Entry" OnAfterModifyEvent
- OnInsertVendorLedgerEntry subscribes to Table "Vendor Ledger Entry" OnAfterInsertEvent
- OnModifyVendorLedgerEntry subscribes to Table "Vendor Ledger Entry" OnAfterModifyEvent
- OnInsertDetailedVendorLedgEntry subscribes to Table "Detailed Vendor Ledg. Entry" OnAfterInsertEvent
- OnModifyDetailedVendorLedgerEntry subscribes to Table "Detailed Vendor Ledg. Entry" OnAfterModifyEvent
- OnInsertEmployeeLedgerEntry subscribes to Table "Employee Ledger Entry" OnAfterInsertEvent
- OnModifyEmployeeLedgerEntry subscribes to Table "Employee Ledger Entry" OnAfterModifyEvent
- OnInsertDetailedEmployeeLedgerEntry subscribes to Table "Detailed Employee Ledger Entry" OnAfterInsertEvent
- OnModifyDetailedEmployeeLedgerEntry subscribes to Table "Detailed Employee Ledger Entry" OnAfterModifyEvent
- OnInsertBankAccountLedgerEntry subscribes to Table "Bank Account Ledger Entry" OnAfterInsertEvent
- OnModifyBankAccountLedgerEntry subscribes to Table "Bank Account Ledger Entry" OnAfterModifyEvent
- OnInsertResourceLedgerEntry subscribes to Table "Res. Ledger Entry" OnAfterInsertEvent
- OnModifyResLedgerEntry subscribes to Table "Res. Ledger Entry" OnAfterModifyEvent
- OnInsertMaintenanceLedgerEntry subscribes to Table "Maintenance Ledger Entry" OnAfterInsertEvent
- OnModifyMaintenanceLedgerEntry subscribes to Table "Maintenance Ledger Entry" OnAfterModifyEvent
- OnInsertJobLedgEntry subscribes to Table "Job Ledger Entry" OnAfterInsertEvent
- OnModifyJobLedgEntry subscribes to Table "Job Ledger Entry" OnAfterModifyEvent
- OnInsertExchRateAdjmtLedgEntry subscribes to Table "Exch. Rate Adjmt. Ledg. Entry" OnAfterInsertEvent
- OnModifyExchRateAdjmtLedgEntry subscribes to Table "Exch. Rate Adjmt. Ledg. Entry" OnAfterModifyEvent
- OnInsertWarehouseEntry subscribes to Table "Warehouse Entry" OnAfterInsertEvent
- OnModifyWarehouseEntry subscribes to Table "Warehouse Entry" OnAfterModifyEvent
- OnInsertPhysInventoryLedgerEntry subscribes to Table "Phys. Inventory Ledger Entry" OnAfterInsertEvent
- OnModifyPhysInventoryLedgerEntry subscribes to Table "Phys. Inventory Ledger Entry" OnAfterModifyEvent
- OnInsertSpendRequestToGLLink subscribes to Table "Spend Request To G/L Link" OnAfterInsertEvent
- OnModifySpendRequestToGLLink subscribes to Table "Spend Request To G/L Link" OnAfterModifyEvent
- OnAfterGenJnlPostLineFinishPosting subscribes to Codeunit "Gen. Jnl.-Post Line" OnAfterFinishPosting
- SetTrueOnSystemSetPostingPreviewActive subscribes to Codeunit "Gen. Jnl.-Post Preview" OnSystemSetPostingPreviewActive
- SetTrueOnSystemSetPostingPreviewActiveBankRecon subscribes to Codeunit "Bank. Acc. Recon. Post Preview" OnSystemSetPostingPreviewActive

## Procedures

- `GetEntries(TableNo: Integer; var RecRef: RecordRef)`: Retrieves captured preview entries for the specified table type. Returns temporary records containing all entries captured during preview processing.
- `IsTransactionConsistent(): Boolean`: Determines whether the posting preview transaction maintained consistency. Validates that all preview operations completed without transaction errors or rollbacks.
- `ShowEntries(TableNo: Integer)`: Displays detailed entries for the specified table type in appropriate preview pages. Opens specialized preview pages showing captured entries for comprehensive analysis.
- `FillDocumentEntry(var TempDocumentEntry: Record "Document Entry" temporary)`: Fills the temporary Document Entry table with all posted entries from the preview transaction.
- `InsertDocumentEntry(RecVar: Variant; var TempDocumentEntry: Record "Document Entry" temporary)`: Inserts a single preview entry into the temporary Document Entry table.
- `PreventCommit()`: Prevents database commits during preview operations to maintain preview-only transaction state.
- `SetShowDocumentNo(NewShowDocNo: Boolean)`: Controls whether document numbers are displayed in preview results.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Page 122 "G/L Entries Preview"](../page/122.md) (1 call: `ShowEntries → (object)`)
- [Page 123 "VAT Entries Preview"](../page/123.md) (1 call: `ShowEntries → (object)`)
- [Page 127 "Det. Cust. Ledg. Entr. Preview"](../page/127.md) (1 call: `ShowEntries → (object)`)
- [Page 129 "Detailed Vend. Entries Preview"](../page/129.md) (1 call: `ShowEntries → (object)`)
- [Page 162 "Resource Ledg. Entries Preview"](../page/162.md) (1 call: `ShowEntries → (object)`)
- [Page 165 "Bank Acc. Ledg. Entr. Preview"](../page/165.md) (1 call: `ShowEntries → (object)`)
- [Page 186 "Exch.Rate Adjmt. Ledg.Entries"](../page/186.md) (1 call: `ShowEntries → (object)`)
- [Page 390 "Phys. Inventory Ledger Entries"](../page/390.md) (1 call: `ShowEntries → (object)`)
- [Page 5240 "Detailed Empl. Entries Preview"](../page/5240.md) (1 call: `ShowEntries → (object)`)
- [Page 5606 "FA Ledger Entries Preview"](../page/5606.md) (1 call: `ShowEntries → (object)`)
- [Page 5671 "Maint. Ledg. Entries Preview"](../page/5671.md) (1 call: `ShowEntries → (object)`)
- [Page 5807 "Value Entries Preview"](../page/5807.md) (1 call: `ShowEntries → (object)`)
- [Page 6844 "Spend Req. To G/L Link Preview"](../page/6844.md) (1 call: `ShowEntries → (object)`)
- [Page 7318 "Warehouse Entries"](../page/7318.md) (1 call: `ShowEntries → (object)`)
- [Page 93 "Job Ledger Entries Preview"](../page/93.md) (1 call: `ShowEntries → (object)`)

## Called by

- [Codeunit 19 "Gen. Jnl.-Post Preview"](../codeunit/19.md) (1 call: `ShowAllEntries → FillDocumentEntry`)
- [Codeunit 373 "Bank. Acc. Recon. Post Preview"](../codeunit/373.md) (1 call: `ShowAllEntries → FillDocumentEntry`)
- [Codeunit 6498 "Serv. Posting Preview Subscr."](../codeunit/6498.md) (1 call: `FillDocumentEntryOnAfterFillDocumentEntry → InsertDocumentEntry`)
- [Codeunit 6792 "Wthldg Tax Preview Handler"](../codeunit/6792.md) (1 call: `FillWithholdingTaxEntries → InsertDocumentEntry`)
- [Codeunit 80 "Sales-Post"](../codeunit/80.md) (1 call: `InsertPostedHeaders → PreventCommit`)
- [Codeunit 90 "Purch.-Post"](../codeunit/90.md) (1 call: `InsertPostedHeaders → PreventCommit`)
- [Codeunit 99000798 "Mfg. Posting Preview Subscr."](../codeunit/99000798.md) (1 call: `FillDocumentEntryOnAfterFillDocumentEntry → InsertDocumentEntry`)
- [Page 1570 "Extended G/L Posting Preview"](../page/1570.md) (1 call: `OnOpenPage → IsTransactionConsistent`)
- [Page 1571 "G/L Entries Preview Subform"](../page/1571.md) (1 call: `Set → GetEntries`)
- [Page 1572 "VAT Entries Preview Subform"](../page/1572.md) (1 call: `Set → GetEntries`)
- [Page 1574 "G/L Entries Preview Flat Subf."](../page/1574.md) (1 call: `Set → GetEntries`)
- [Page 1575 "VAT Entries Preview Flat Subf."](../page/1575.md) (1 call: `Set → GetEntries`)

## Recent changes

- 2026-08-16 [#9067 Production Definition Wizard - Implementation](../../changes/bcapps/9067.md) (main, BC30, feature)
- 2026-08-10 [#9391 [Master] - Slice 616928: [Expense Management] [App part] Expense Managements Travel Requisitions 💸](../../changes/bcapps/9391.md) (main, BC30, feature)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC25-26, BC29

## Countries that replace it

[AU](../../localizations/au.md), [NZ](../../localizations/nz.md), [RU](../../localizations/ru.md)

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "Posting Preview Event Handler")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
