Skip to main content

Posting Preview

Preview lets a caller run a posting operation in a non-committing mode: it validates the request and returns whether it would post - without committing a document, consuming a number sequence, consuming an idempotency claim, or emitting a business event.

How to request a preview​

Set "PreviewMode": true on the request payload, or use the Preview mode toggle on the service test console (System administration › Inquiries › Lattice › Services › Service test console).

{ "PreviewMode": true, "JournalNameId": "GenJrn", "Lines": [ ... ] }

Every write operation accepts PreviewMode. An operation that does not implement a preview refuses PreviewMode: true with Success = false and ErrorCode PreviewUnsupported (10) before it reads or writes anything, so a preview request never posts by mistake.

Every response carries three preview members:

FieldMeaning
PreviewModetrue when the request asked for a preview (also on a PreviewUnsupported refusal)
PreviewAppliedtrue when the preview completed cleanly: the request was validated, nothing was posted, and no claim or open transaction was left behind
PreviewFidelity0 = None (not a preview, every normal call), 1 = ValidationOnly (the request was validated without posting)

Preview-capable operations​

These operations validate the request and return without posting (ValidationOnly); no number sequence is consumed:

  • MGCLatticeGeneralLedgerJournalService - postGeneralJournal, postIntercompanyJournal
  • MGCLatticeSalesOrderPostingService - confirmSalesOrder, postSalesPackingSlip, invoiceSalesOrder

The operation sections of the endpoint payload specification name any other operation that implements a preview. To make an operation preview-capable: (1) its request contract implements MGCLatticeIPreviewableRequest with a PreviewMode DataMember, (2) the operation calls beginPreview, validates, and finishes with previewValidationResult (mirror MGCLatticeGeneralLedgerJournalService.postGeneralJournal). An operation without a preview branch refuses the flag with finalizePreviewUnsupported.

A preview never runs the posting engine and aborts it: D365 commits number-sequence pointers in their own transaction, so a run-and-abort post would leave real gaps in non-continuous invoice and voucher numbers.

Guarantees​

  • No idempotency claim is written or consumed in preview (checkIdempotencyUnlessPreview; the claim block in recordCompletion is skipped). A preview is not license-gated.
  • Audit-visible: the call-log row is flagged IsPreview = Yes.
  • No business events: a preview never posts, so none are raised.
  • Self-check: verifyPreviewClean asserts no claim leaked and the transaction unwound (ttsLevel == 0); any leak is reported in Warnings and clears PreviewApplied.

Security​

A preview is the posting operation called with PreviewMode set, so it needs that operation's own invoke privilege; there is no separate preview privilege. The MGCLatticePostingPreviewExecute privilege (duty MGCLatticePostingPreviewDuty, View sales order and journal posting status) grants only the read-only getSalesOrderStatus and getJournalStatus operations and no posting rights. Preview runs are attributable via the IsPreview call-log rows, which record the user the call ran as.

OpenAPI​

The PreviewMode request member and the preview response members are part of each operation's data contract, so they appear in the operation's OpenAPI schema.