---
title: "Codeunit 817 Service Post Invoice, extension points 29"
author: "JOP-AL"
url: https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/points/
object: https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/
app: "Base Application"
major: 29
source: https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/
checked: 2026-11-20
changed: 2026-10-05
subject: "Microsoft Dynamics 365 Business Central"
license: "Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/"
---

# Codeunit 817 Service Post Invoice, extension points 29

JOP-AL, https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/points/

11 procedures and triggers with a step in src/Layers/W1/BaseApp/Service/Posting/ServicePostInvoice.Codeunit.al, in source order, read from the text, not from a run.

## PrepareLine

[Line 69](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L69).

- [91](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L91) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnBeforePrepareLine`
- [95](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L95) calls [Table 98 General Ledger Setup](https://jonas-paprotka.de/ref/table/98-general-ledger-setup/) `UseVat`
- [101](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L101) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineAfterGetGenPostingSetup`
- [103](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L103) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineOnAfterGetGenPostingSetup`
- [105](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L105) calls `PrepareInvoicePostingBuffer`
- [118](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L118) calls `CalcInvoiceDiscountPosting`
- [120](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L120) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `SetAccount`
- [121](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L121) calls [Table 252 General Posting Setup](https://jonas-paprotka.de/ref/table/252-general-posting-setup/) `GetSalesInvDiscAccount`
- [122](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L122) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `UpdateVATBase`
- [129](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L129) calls `UpdateInvoicePostingBuffer`
- [136](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L136) calls `CalcLineDiscountPosting`
- [138](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L138) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `SetAccount`
- [139](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L139) calls [Table 252 General Posting Setup](https://jonas-paprotka.de/ref/table/252-general-posting-setup/) `GetSalesLineDiscAccount`
- [140](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L140) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `UpdateVATBase`
- [141](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L141) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineOnBeforeUpdateInvoicePostingBufferLineDiscounts`
- [142](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L142) calls `UpdateInvoicePostingBuffer`
- [147](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L147) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineOnBeforeSetAmounts`
- [151](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L151) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `SetAmounts`
- [153](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L153) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineOnAfterSetAmounts`
- [155](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L155) calls `GetSalesAccount`
- [156](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L156) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineOnBeforeSetAccount`
- [157](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L157) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `SetAccount`
- [158](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L158) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `UpdateVATBase`
- [160](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L160) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPrepareLineOnAfterFillInvoicePostingBuffer`
- [163](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L163) calls `UpdateInvoicePostingBuffer`

## GetSalesAccount

[Line 166](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L166), local.

- [172](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L172) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnBeforeGetSalesAccount`
- [184](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L184) calls [Table 252 General Posting Setup](https://jonas-paprotka.de/ref/table/252-general-posting-setup/) `GetSalesCrMemoAccount`
- [186](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L186) calls [Table 252 General Posting Setup](https://jonas-paprotka.de/ref/table/252-general-posting-setup/) `GetSalesAccount`
- [189](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L189) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnAfterGetSalesAccount`

## CalcInvoiceDiscountPosting

[Line 192](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L192), local.

- [197](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L197) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnBeforeCalcInvoiceDiscountPosting`
- [202](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L202) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `CalcDiscountNoVAT`
- [205](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L205) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `CalcDiscount`

## CalcLineDiscountPosting

[Line 209](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L209), local.

- [214](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L214) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnBeforeCalcLineDiscountPosting`
- [219](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L219) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `CalcDiscountNoVAT`
- [222](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L222) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `CalcDiscount`

## PrepareInvoicePostingBuffer

[Line 226](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L226).

- [228](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L228) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnBeforePrepareInvoicePostingBuffer`
- [249](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L249) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `GetVATPct`
- [259](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L259) calls `UpdateEntryDescriptionFromServiceLine`
- [261](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L261) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnAfterPrepareInvoicePostingBuffer`

## UpdateEntryDescriptionFromServiceLine

[Line 264](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L264), local.

- [271](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L271) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `UpdateEntryDescription`

## UpdateInvoicePostingBuffer

[Line 278](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L278), local.

- [286](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L286) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnUpdateInvoicePostingBufferOnBeforeUpdate`
- [287](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L287) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `Update`
- [288](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L288) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnAfterUpdateInvoicePostingBuffer`

## PostLines

[Line 291](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L291).

- [300](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L300) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnBeforePostLines`
- [309](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L309) calls `PrepareGenJnlLineFromInvoicePostBuffer`
- [311](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L311) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostLinesOnBeforeGenJnlLinePost`
- [313](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L313) calls [Codeunit 12 Gen. Jnl.-Post Line](https://jonas-paprotka.de/ref/codeunit/12-gen-jnl-post-line/) `RunWithCheck`
- [314](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L314) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostLinesOnAfterGenJnlLinePost`

## PrepareGenJnlLineFromInvoicePostBuffer

[Line 322](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L322), local.

- [324](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L324) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `InitNewLine`
- [329](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L329) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `CopyDocumentFields`
- [333](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L333) calls [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) `CopyToGenJournalLine`
- [335](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L335) calls [Table 55 Invoice Posting Buffer](https://jonas-paprotka.de/ref/table/55-invoice-posting-buffer/) `CopyToGenJnlLine`
- [337](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L337) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnAfterPrepareGenJnlLineFromInvoicePostBuffer`

## PostLedgerEntry

[Line 344](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L344).

- [352](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L352) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `InitNewLine`
- [357](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L357) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `CopyDocumentFields`
- [363](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L363) calls [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) `CopyToGenJournalLine`
- [364](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L364) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `SetCurrencyFactor`
- [366](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L366) calls [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) `CopyToGenJournalLineApplyTo`
- [367](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L367) calls [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) `CopyToGenJournalLinePayment`
- [378](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L378) calls [Table 330 Currency Exchange Rate](https://jonas-paprotka.de/ref/table/330-currency-exchange-rate/) `ExchangeAmtFCYToLCY`
- [381](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L381) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostLedgerEntryOnBeforeGenJnlPostLine`
- [383](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L383) calls [Codeunit 12 Gen. Jnl.-Post Line](https://jonas-paprotka.de/ref/codeunit/12-gen-jnl-post-line/) `RunWithCheck`
- [384](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L384) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostLedgerEntryOnAfterGenJnlPostLine`

## PostBalancingEntry

[Line 388](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L388).

- [398](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L398) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostBalancingEntryOnBeforeFindCustLedgerEntry`
- [400](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L400) calls `FindCustLedgerEntry`
- [402](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L402) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `InitNewLine`
- [408](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L408) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `CopyDocumentFields`
- [412](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L412) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `CopyDocumentFields`
- [418](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L418) calls [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) `CopyToGenJournalLine`
- [419](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L419) calls [Table 81 Gen. Journal Line](https://jonas-paprotka.de/ref/table/81-gen-journal-line/) `SetCurrencyFactor`
- [421](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L421) calls `SetApplyToDocNo`
- [434](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L434) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostBalancingEntryOnBeforeGenJnlPostLine`
- [436](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L436) calls [Codeunit 12 Gen. Jnl.-Post Line](https://jonas-paprotka.de/ref/codeunit/12-gen-jnl-post-line/) `RunWithCheck`
- [437](https://jonas-paprotka.de/ref/codeunit/817-service-post-invoice/source/#L437) calls [Codeunit 827 Service Post Invoice Events](https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/) `RunOnPostBalancingEntryOnAfterGenJnlPostLine`

## Source

AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at 4303e5e584d3aa5d9e98cbc615525a5396ad6ed7.

JOP-AL, 2026-11-20.
