---
title: "Codeunit 827 Service Post Invoice Events"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/
type: codeunit
id: 827
name: "Service Post Invoice Events"
app: "Base Application"
namespace: Microsoft.Service.Posting
versions: "20-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 827 Service Post Invoice Events

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/827-service-post-invoice-events/

| | |
| --- | --- |
| App | Base Application |
| Namespace | Microsoft.Service.Posting |
| Versions | 20-28 |
| Source file | Service/Posting/ServicePostInvoiceEvents.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| RunOnAfterUpdateInvoicePostingBuffer | (var Record Invoice Posting Buffer) | - | public | 20-28 | - | - |
| RunOnBeforePrepareLine | (Record Service Header, Record Service Line, Record Service Line, var Boolean) | - | public | 20-28 | - | - |
| RunOnBeforeCalcInvoiceDiscountPosting | (Record Service Header, Record Service Line, Record Service Line, var Record Invoice Posting Buffer, var Boolean) | - | public | 20-28 | - | - |
| RunOnBeforeCalcLineDiscountPosting | (Record Service Header, Record Service Line, Record Service Line, var Record Invoice Posting Buffer, var Boolean) | - | public | 20-28 | - | - |
| RunOnPrepareLineOnAfterFillInvoicePostingBuffer | (var Record Invoice Posting Buffer, Record Service Line, Record Service Line, Boolean) | - | public | 20-28 | Pending 27.0 | Replaced by same procedure with parameter TempInvoicePostingBuffer |
| RunOnPostBalancingEntryOnAfterGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | - | public | 20-28 | - | - |
| RunOnPostBalancingEntryOnBeforeGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | - | public | 20-28 | - | - |
| RunOnPostLedgerEntryOnAfterGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | - | public | 20-28 | - | - |
| RunOnPostLedgerEntryOnBeforeGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | - | public | 20-28 | Pending 26.0 | Replaced by same procedure with parameter InvoicePostingParameters |
| RunOnPostLinesOnAfterGenJnlLinePost | (var Record Gen. Journal Line, Record Service Header, Record Invoice Posting Buffer, var Codeunit Gen. Jnl.-Post Line, Boolean, Boolean, Integer) | - | public | 20-28 | - | - |
| RunOnPostLinesOnBeforeGenJnlLinePost | (var Record Gen. Journal Line, Record Service Header, Record Invoice Posting Buffer, var Codeunit Gen. Jnl.-Post Line, Boolean, Boolean) | - | public | 20-28 | - | - |
| RunOnUpdateInvoicePostingBufferOnBeforeUpdate | (var Record Invoice Posting Buffer) | - | public | 20-28 | - | - |
| RunOnAfterGetSalesAccount | (Record Service Line, Record General Posting Setup, var Code[20]) | - | public | 21-28 | - | - |
| RunOnBeforeGetSalesAccount | (Record Service Line, Record General Posting Setup, var Code[20], var Boolean) | - | public | 21-28 | - | - |
| RunOnPrepareLineOnAfterSetAmounts | (var Record Invoice Posting Buffer, Record Service Line) | - | public | 21-28 | - | - |
| RunOnPrepareLineOnBeforeSetAmounts | (Record Service Line, Record Service Line, var Record Invoice Posting Buffer, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Boolean) | - | public | 21-28 | - | - |
| RunOnPrepareLineOnBeforeSetAccount | (Record Service Header, Record Service Line, var Code[20]) | - | public | 21-28 | - | - |
| RunOnPrepareLineAfterGetGenPostingSetup | (var Record General Posting Setup, Record Service Header, Record Service Line, Record Service Line) | - | public | 22-28 | - | - |
| RunOnAfterPrepareGenJnlLineFromInvoicePostBuffer | (Record Service Header, var Record Invoice Posting Buffer, var Record Gen. Journal Line) | - | public | 23-28 | - | - |
| RunOnPostBalancingEntryOnBeforeFindCustLedgerEntry | (var Record Service Header, var Record Cust. Ledger Entry, var Boolean) | - | internal | 23-28 | - | - |
| RunOnPrepareLineOnBeforeUpdateInvoicePostingBufferLineDiscounts | (var Record Invoice Posting Buffer, Record Service Line) | - | public | 24-28 | - | - |
| RunOnAfterPrepareInvoicePostingBuffer | (var Record Service Line, var Record Invoice Posting Buffer) | - | public | 25-28 | - | - |
| RunOnBeforePrepareInvoicePostingBuffer | (var Record Service Line, var Record Invoice Posting Buffer) | - | public | 25-28 | - | - |
| RunOnBeforePostLines | (Record Service Header, var Record Invoice Posting Buffer) | - | public | 26-28 | - | - |
| RunOnPrepareLineOnAfterFillInvoicePostingBuffer | (var Record Invoice Posting Buffer, Record Service Line, Record Service Line, Boolean, var Record Invoice Posting Buffer) | - | public | 26-28 | - | - |
| RunOnPostLedgerEntryOnBeforeGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line, Record Invoice Posting Parameters) | - | public | 26-28 | - | - |
| RunOnPrepareLineOnAfterGetGenPostingSetup | (Record Service Line, Record Service Line, var Record General Posting Setup) | - | internal | 28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnAfterUpdateInvoicePostingBuffer | (var Record Invoice Posting Buffer) | 20-28 | - | - |
| Integration event | OnBeforePrepareLine | (Record Service Header, Record Service Line, Record Service Line, var Boolean) | 20-28 | - | - |
| Integration event | OnBeforeCalcInvoiceDiscountPosting | (Record Service Header, Record Service Line, Record Service Line, var Record Invoice Posting Buffer, var Boolean) | 20-28 | - | - |
| Integration event | OnBeforeCalcLineDiscountPosting | (Record Service Header, Record Service Line, Record Service Line, var Record Invoice Posting Buffer, var Boolean) | 20-28 | - | - |
| Integration event | OnPrepareLineOnAfterFillInvoicePostingBuffer | (var Record Invoice Posting Buffer, Record Service Line, Record Service Line, Boolean) | 20-25 | - | - |
| Integration event | OnPostBalancingEntryOnAfterGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | 20-28 | - | - |
| Integration event | OnPostBalancingEntryOnBeforeGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | 20-28 | - | - |
| Integration event | OnPostLedgerEntryOnAfterGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | 20-28 | - | - |
| Integration event | OnPostLedgerEntryOnBeforeGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line) | 20-25 | - | - |
| Integration event | OnPostLinesOnAfterGenJnlLinePost | (var Record Gen. Journal Line, Record Service Header, Record Invoice Posting Buffer, var Codeunit Gen. Jnl.-Post Line, Boolean, Boolean, Integer) | 20-28 | - | - |
| Integration event | OnPostLinesOnBeforeGenJnlLinePost | (var Record Gen. Journal Line, Record Service Header, Record Invoice Posting Buffer, var Codeunit Gen. Jnl.-Post Line, Boolean, Boolean) | 20-28 | - | - |
| Integration event | OnUpdateInvoicePostingBufferOnBeforeUpdate | (var Record Invoice Posting Buffer) | 20-28 | - | - |
| Integration event | OnAfterGetSalesAccount | (Record Service Line, Record General Posting Setup, var Code[20]) | 21-28 | - | - |
| Integration event | OnBeforeGetSalesAccount | (Record Service Line, Record General Posting Setup, var Code[20], var Boolean) | 21-28 | - | - |
| Integration event | OnPrepareLineOnAfterSetAmounts | (var Record Invoice Posting Buffer, Record Service Line) | 21-28 | - | - |
| Integration event | OnPrepareLineOnBeforeSetAmounts | (Record Service Line, Record Service Line, var Record Invoice Posting Buffer, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Decimal, var Boolean) | 21-28 | - | - |
| Integration event | OnPrepareLineOnBeforeSetAccount | (Record Service Header, Record Service Line, var Code[20]) | 21-28 | - | - |
| Integration event | OnPrepareLineAfterGetGenPostingSetup | (var Record General Posting Setup, Record Service Header, Record Service Line, Record Service Line) | 22-28 | - | - |
| Integration event | OnAfterPrepareGenJnlLineFromInvoicePostBuffer | (Record Service Header, var Record Invoice Posting Buffer, var Record Gen. Journal Line) | 23-28 | - | - |
| Integration event | OnPostBalancingEntryOnBeforeFindCustLedgerEntry | (var Record Service Header, var Record Cust. Ledger Entry, var Boolean) | 23-28 | - | - |
| Integration event | OnPrepareLineOnBeforeUpdateInvoicePostingBufferLineDiscounts | (var Record Invoice Posting Buffer, Record Service Line) | 24-28 | - | - |
| Integration event | OnAfterPrepareInvoicePostingBuffer | (var Record Service Line, var Record Invoice Posting Buffer) | 25-28 | - | - |
| Integration event | OnBeforePrepareInvoicePostingBuffer | (var Record Service Line, var Record Invoice Posting Buffer) | 25-28 | - | - |
| Integration event | OnBeforePostLines | (Record Service Header, var Record Invoice Posting Buffer) | 26-28 | - | - |
| Integration event | OnPrepareLineOnAfterFillInvoicePostingBuffer | (var Record Invoice Posting Buffer, Record Service Line, Record Service Line, Boolean, var Record Invoice Posting Buffer) | 26-28 | - | - |
| Integration event | OnPostLedgerEntryOnBeforeGenJnlPostLine | (var Record Gen. Journal Line, Record Service Header, var Record Service Line, var Record Service Line, Boolean, Boolean, var Codeunit Gen. Jnl.-Post Line, Record Invoice Posting Parameters) | 26-28 | - | - |
| Integration event | OnPrepareLineOnAfterGetGenPostingSetup | (Record Service Line, Record Service Line, var Record General Posting Setup) | 28 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
