---
id: object/codeunit/19
type: object
title: Codeunit 19 "Gen. Jnl.-Post Preview"
summary: Codeunit 19 "Gen. Jnl.-Post Preview" in Base Application (Microsoft.Finance.GeneralLedger.Preview). 8 public procedures, 10 events. Present since at least BC23, still in BC30, changed in BC24.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "24"
  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: ab02ba3860201bc699ace9f31b2c4282607d39c09889fc9504ad59a23a427733
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/Finance/GeneralLedger/Preview/GenJnlPostPreview.Codeunit.al
    title: src/Layers/W1/BaseApp/Finance/GeneralLedger/Preview/GenJnlPostPreview.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 19
name: Gen. Jnl.-Post Preview
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:
  - "24"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 21
  events: 10
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 37
  calls: 7
  called_by: 40
  implements: 0
---

# Codeunit 19 "Gen. Jnl.-Post Preview"

> Codeunit 19 "Gen. Jnl.-Post Preview" in Base Application (Microsoft.Finance.GeneralLedger.Preview). 8 public procedures, 10 events. Present since at least BC23, still in BC30, changed in BC24.

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/GenJnlPostPreview.Codeunit.al) · facts from BC29

## Events published

- `OnBeforeRunPreview(Subscriber: Variant; RecVar: Variant)` (integration): Integration event raised before executing posting preview operations. Enables custom preprocessing or validation before preview execution begins.
- `OnRunPreview(var Result: Boolean; Subscriber: Variant; RecVar: Variant)` (integration): Integration event raised to execute the actual posting preview operation. Allows custom posting codeunits to participate in the preview execution workflow.
  - subscribers: [Codeunit 1021 "Job Jnl.-Post"](../codeunit/1021.md) OnRunPreview, [Codeunit 224 "EmplEntry-Apply Posted Entries"](../codeunit/224.md) OnRunPreview, [Codeunit 226 "CustEntry-Apply Posted Entries"](../codeunit/226.md) OnRunPreview, [Codeunit 227 "VendEntry-Apply Posted Entries"](../codeunit/227.md) OnRunPreview, [Codeunit 231 "Gen. Jnl.-Post"](../codeunit/231.md) OnRunPreview, [Codeunit 241 "Item Jnl.-Post"](../codeunit/241.md) OnRunPreview, [Codeunit 443 "Sales-Post Prepayment (Yes/No)"](../codeunit/443.md) OnRunPreview, [Codeunit 445 "Purch.-Post Prepmt. (Yes/No)"](../codeunit/445.md) OnRunPreview, [Codeunit 5636 "FA. Jnl.-Post"](../codeunit/5636.md) OnRunPreview, [Codeunit 5706 "TransferOrder-Post (Yes/No)"](../codeunit/5706.md) OnRunPreview, [Codeunit 5761 "Whse.-Post Receipt (Yes/No)"](../codeunit/5761.md) OnRunPreview, [Codeunit 5764 "Whse.-Post Shipment (Yes/No)"](../codeunit/5764.md) OnRunPreview, [Codeunit 5853 "Invt. Doc.-Post (Yes/No)"](../codeunit/5853.md) OnRunPreview, [Codeunit 5883 "Phys. Invt. Order-Post (Y/N)"](../codeunit/5883.md) OnRunPreview, [Codeunit 5981 "Service-Post (Yes/No)"](../codeunit/5981.md) OnRunPreview, [Codeunit 699 "Exch. Rate Adjmt. Process"](../codeunit/699.md) OnRunPreview, [Codeunit 6997 "Expense Preview Post Mgt."](../codeunit/6997.md) OnRunPreview, [Codeunit 7323 "Whse.-Act.-Post (Yes/No)"](../codeunit/7323.md) OnRunPreview, [Codeunit 81 "Sales-Post (Yes/No)"](../codeunit/81.md) OnRunPreview, [Codeunit 901 "Assembly-Post (Yes/No)"](../codeunit/901.md) OnRunPreview, and 2 more
- `OnAfterBindSubscription(var PostingPreviewEventHandler: Codeunit "Posting Preview Event Handler")` (integration): Integration event raised after binding the posting preview event handler subscription. Enables custom initialization or configuration of the preview event handler.
  - subscribers: [Codeunit 20565 "Subc. Posting Preview Binding"](../codeunit/20565.md) BindPostPrevEventHandlerOnAfterBindSubscription, [Codeunit 6225 "Sust. Purchase Subscriber"](../codeunit/6225.md) OnAfterBindSubscription, [Codeunit 6496 "Serv. Posting Preview Binding"](../codeunit/6496.md) BindPostPrevEventHandlerOnAfterBindSubscription, [Codeunit 6792 "Wthldg Tax Preview Handler"](../codeunit/6792.md) OnAfterBindSubscription, [Codeunit 6987 "Expense Report-Post"](../codeunit/6987.md) OnAfterBindSubscription, [Codeunit 8076 "Deferral Post. Preview Binding"](../codeunit/8076.md) BindDeferralPreviewHandlerOnAfterBindSubscription, [Codeunit 99000796 "Mfg. Posting Preview Binding"](../codeunit/99000796.md) BindPostPrevEventHandlerOnAfterBindSubscription
- `OnAfterUnbindSubscription()` (integration): Integration event raised after unbinding the posting preview event handler subscription. Enables custom cleanup or finalization after preview processing completes.
  - subscribers: [Codeunit 20565 "Subc. Posting Preview Binding"](../codeunit/20565.md) UnbindPostPrecEventHandlerOnAfterUnbindSubscription, [Codeunit 6225 "Sust. Purchase Subscriber"](../codeunit/6225.md) OnAfterUnbindSubscription, [Codeunit 6496 "Serv. Posting Preview Binding"](../codeunit/6496.md) UnbindPostPrecEventHandlerOnAfterUnbindSubscription, [Codeunit 6987 "Expense Report-Post"](../codeunit/6987.md) OnAfterUnbindSubscription, [Codeunit 8076 "Deferral Post. Preview Binding"](../codeunit/8076.md) UnbindDeferralPreviewHandlerOnAfterUnbindSubscription, [Codeunit 99000796 "Mfg. Posting Preview Binding"](../codeunit/99000796.md) UnbindPostPrecEventHandlerOnAfterUnbindSubscription
- `OnSystemSetPostingPreviewActive(var Result: Boolean)` (integration): Integration event raised to determine if posting preview mode is active at system level. Allows extensions to indicate whether preview operations should be enabled.
  - subscribers: [Codeunit 20 "Posting Preview Event Handler"](../codeunit/20.md) SetTrueOnSystemSetPostingPreviewActive
- `OnAfterIsActive(var Result: Boolean)` (integration): Integration event raised after checking if posting preview is active. Enables extensions to modify the active state determination logic.
- `OnBeforeShowAllEntries(var TempDocumentEntry: Record "Document Entry" temporary; var IsHandled: Boolean; var PostingPreviewEventHandler: Codeunit "Posting Preview Event Handler")` (integration): Integration event raised before displaying all preview entries to the user. Enables custom entry filtering, modification, or alternative display handling.
- `OnBeforeThrowError()` (integration): Integration event raised before throwing the preview mode error to exit gracefully. Enables custom cleanup or finalization before preview termination.
- `OnAfterShowAllEntries()` (integration): Integration event raised after displaying all preview entries to the user. Enables custom post-display processing or additional user interactions.
- `OnShowAllEntriesOnCaseElse(var TempDocumentEntry: Record "Document Entry" temporary; var PostingPreviewEventHandler: Codeunit "Posting Preview Event Handler")` (integration): Integration event raised when no standard preview type matches the configuration. Enables custom preview display handling for extended preview scenarios.

## Trigger event subscribers

- OnAfterUnBindSubscription: [Codeunit 6792 "Wthldg Tax Preview Handler"](../codeunit/6792.md) OnAfterUnBindSubscription

## Procedures

- `Preview(Subscriber: Variant; RecVar: Variant)`: Initiates posting preview for the specified document record using the provided posting codeunit. Executes posting logic in simulation mode without committing database transactions.
- `GetPreviewHandler(var ResultPostingPreviewEventHandler: Codeunit "Posting Preview Event Handler")`: Retrieves the current posting preview event handler instance for external processing. Enables access to captured preview entries and transaction details.
- `IsActive(): Boolean`: Determines whether posting preview mode is currently active. Checks both system-level and extension-specific preview activation status.
- `IsSuccess(): Boolean`: Determines whether the posting preview operation completed successfully. Validates that preview execution finished without posting errors.
- `SetContext(Subscriber: Variant; RecVar: Variant)`: Sets the context for posting preview operations with the specified posting codeunit and record. Configures preview environment for later execution without immediate preview processing.
- `ShowDimensions(TableID: Integer; EntryNo: Integer; DimensionSetID: Integer)`: Displays dimension information for a specific entry during posting preview operations. Shows dimension set details associated with preview entries for validation and analysis.
- `ThrowError()`: Triggers the preview mode error to exit posting preview operations gracefully. Used to terminate preview processing and return to normal application flow.
- `MessageIfPostingPreviewMultipleDocuments(RecordRefToPreview: RecordRef; DocumentNo: Code[20])`: Displays a message when posting preview is requested for multiple documents. Informs users that preview will only show results for the first document in the selection.

Plus 3 local procedures.

## 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.

- [Codeunit 28 "Error Message Management"](../codeunit/28.md) (3 calls: `OnRun → LogError`, `PreviewStart → Activate`, `PreviewStart → PushContext`)
- [Codeunit 20 "Posting Preview Event Handler"](../codeunit/20.md) (1 call: `ShowAllEntries → FillDocumentEntry`)
- [Codeunit 29 "Error Message Handler"](../codeunit/29.md) (1 call: `PreviewStart → ShowErrors`)
- [Codeunit 408 "DimensionManagement"](../codeunit/408.md) (1 call: `ShowDimensions → ShowDimensionSet`)
- [Codeunit 8703 "Feature Telemetry"](../codeunit/8703.md) (1 call: `Preview → LogUsage`)
- [Codeunit 9080 "Journal Errors Mgt."](../codeunit/9080.md) (1 call: `ShowAllEntries → GetNothingToPostErrorMsg`)
- [Codeunit 9500 "Sequence No. Mgt."](../codeunit/9500.md) (1 call: `PreviewStart → StopPreviewMode`)

## Called by

- [Codeunit 224 "EmplEntry-Apply Posted Entries"](../codeunit/224.md) (4 calls: `EmplPostApplyEmplLedgEntry → ThrowError`, `PostUnApplyEmployee → ThrowError`, `PreviewApply → Preview`, …)
- [Codeunit 226 "CustEntry-Apply Posted Entries"](../codeunit/226.md) (4 calls: `CustPostApplyCustLedgEntry → ThrowError`, `PostUnApplyCustomerCommit → ThrowError`, `PreviewApply → Preview`, …)
- [Codeunit 227 "VendEntry-Apply Posted Entries"](../codeunit/227.md) (4 calls: `PostUnApplyVendorCommit → ThrowError`, `PreviewApply → Preview`, `PreviewUnapply → Preview`, …)
- [Codeunit 426 "Payment Tolerance Management"](../codeunit/426.md) (4 calls: `CallPmtDiscTolWarning → IsActive`, `CallPmtTolWarning → IsActive`, `PurchPmtTolGenJnl → IsActive`, …)
- [Codeunit 5706 "TransferOrder-Post (Yes/No)"](../codeunit/5706.md) (3 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `PostTransferOrder → ThrowError`, `Preview → Preview`)
- [Codeunit 5981 "Service-Post (Yes/No)"](../codeunit/5981.md) (3 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `PreviewDocument → Preview`, `PreviewDocumentWithLines → Preview`)
- [Codeunit 1021 "Job Jnl.-Post"](../codeunit/1021.md) (2 calls: `Code → ThrowError`, `Preview → Preview`)
- [Codeunit 1520 "Workflow Event Handling"](../codeunit/1520.md) (2 calls: `RunWorkflowOnItemChanged → IsActive`, `RunWorkflowOnItemRenamed → IsActive`)
- [Codeunit 241 "Item Jnl.-Post"](../codeunit/241.md) (2 calls: `Code → ThrowError`, `Preview → Preview`)
- [Codeunit 5761 "Whse.-Post Receipt (Yes/No)"](../codeunit/5761.md) (2 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `Preview → Preview`)
- [Codeunit 5764 "Whse.-Post Shipment (Yes/No)"](../codeunit/5764.md) (2 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `Preview → Preview`)
- [Codeunit 5853 "Invt. Doc.-Post (Yes/No)"](../codeunit/5853.md) (2 calls: `Code → ThrowError`, `Preview → Preview`)
- [Codeunit 699 "Exch. Rate Adjmt. Process"](../codeunit/699.md) (2 calls: `OnRun → ThrowError`, `Preview → Preview`)
- [Codeunit 7323 "Whse.-Act.-Post (Yes/No)"](../codeunit/7323.md) (2 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `Preview → Preview`)
- [Codeunit 81 "Sales-Post (Yes/No)"](../codeunit/81.md) (2 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `Preview → Preview`)
- [Codeunit 900 "Assembly-Post"](../codeunit/900.md) (2 calls: `InitPost → IsActive`, `OnRun → ThrowError`)
- [Codeunit 901 "Assembly-Post (Yes/No)"](../codeunit/901.md) (2 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `Preview → Preview`)
- [Codeunit 91 "Purch.-Post (Yes/No)"](../codeunit/91.md) (2 calls: `MessageIfPostingPreviewMultipleDocuments → MessageIfPostingPreviewMultipleDocuments`, `Preview → Preview`)
- [Codeunit 13 "Gen. Jnl.-Post Batch"](../codeunit/13.md) (1 call: `ProcessLines → ThrowError`)
- [Codeunit 20411 "Qlty. Receiving Integration"](../codeunit/20411.md) (1 call: `DetectIsPreviewPosting → IsActive`)
- [Codeunit 21 "Item Jnl.-Check Line"](../codeunit/21.md) (1 call: `RunCheck → IsActive`)
- [Codeunit 231 "Gen. Jnl.-Post"](../codeunit/231.md) (1 call: `Preview → Preview`)
- [Codeunit 431 "IC Outbox Export"](../codeunit/431.md) (1 call: `SendToExternalPartner → IsActive`)
- [Codeunit 442 "Sales-Post Prepayments"](../codeunit/442.md) (1 call: `Code → ThrowError`)
- [Codeunit 443 "Sales-Post Prepayment (Yes/No)"](../codeunit/443.md) (1 call: `Preview → Preview`)
- [Codeunit 444 "Purchase-Post Prepayments"](../codeunit/444.md) (1 call: `Code → ThrowError`)
- [Codeunit 445 "Purch.-Post Prepmt. (Yes/No)"](../codeunit/445.md) (1 call: `Preview → Preview`)
- [Codeunit 5633 "FA Jnl.-Post Batch"](../codeunit/5633.md) (1 call: `Code → ThrowError`)
- [Codeunit 5636 "FA. Jnl.-Post"](../codeunit/5636.md) (1 call: `Preview → Preview`)
- [Codeunit 5760 "Whse.-Post Receipt"](../codeunit/5760.md) (1 call: `Code → ThrowError`)
- [Codeunit 5763 "Whse.-Post Shipment"](../codeunit/5763.md) (1 call: `Code → ThrowError`)
- [Codeunit 5883 "Phys. Invt. Order-Post (Y/N)"](../codeunit/5883.md) (1 call: `Preview → Preview`)
- [Codeunit 5884 "Phys. Invt. Order-Post"](../codeunit/5884.md) (1 call: `Code → ThrowError`)
- [Codeunit 5980 "Service-Post"](../codeunit/5980.md) (1 call: `PostDocumentLines → ThrowError`)
- [Codeunit 6987 "Expense Report-Post"](../codeunit/6987.md) (1 call: `RunWithCheck → ThrowError`)
- [Codeunit 7324 "Whse.-Activity-Post"](../codeunit/7324.md) (1 call: `Code → ThrowError`)
- [Codeunit 80 "Sales-Post"](../codeunit/80.md) (1 call: `FinalizePosting → ThrowError`)
- [Codeunit 90 "Purch.-Post"](../codeunit/90.md) (1 call: `FinalizePosting → ThrowError`)
- [Codeunit 980 "Payment Registration Mgt."](../codeunit/980.md) (1 call: `Preview → Preview`)
- [Table 6906 "Expense Report Header"](../table/6906.md) (1 call: `Preview → Preview`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24

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: "Gen. Jnl.-Post Preview")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
