---
title: "Codeunit 1303 Correct Posted Sales Invoice"
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/
type: codeunit
id: 1303
name: "Correct Posted Sales Invoice"
app: "Base Application"
namespace: Microsoft.Sales.History
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/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 1303 Correct Posted Sales Invoice

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/1303-correct-posted-sales-invoice/

| | |
| --- | --- |
| App | Base Application |
| Namespace | Microsoft.Sales.History |
| Versions | 17-28 |
| Source file | Sales/History/CorrectPostedSalesInvoice.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| CancelPostedInvoice | (var Record Sales Invoice Header) | Boolean | public | 17-28 | - | - |
| CreateCreditMemoCopyDocument | (var Record Sales Invoice Header, var Record Sales Header) | Boolean | public | 17-28 | - | - |
| CreateCorrectiveCreditMemo | (var Notification) | - | public | 17-28 | - | - |
| ShowAppliedEntries | (var Notification) | - | public | 17-28 | - | - |
| SkipCorrectiveCreditMemo | (var Notification) | - | public | 17-28 | - | - |
| CancelPostedInvoiceCreateNewInvoice | (var Record Sales Invoice Header, var Record Sales Header) | - | public | 17-28 | - | - |
| CancelPostedInvoiceStartNewInvoice | (var Record Sales Invoice Header, var Record Sales Header) | - | public | 17-19 | Pending 17.0 | Replaced by CancelPostedInvoiceCreateNewInvoice() |
| TestCorrectInvoiceIsAllowed | (var Record Sales Invoice Header, Boolean) | - | public | 17-28 | - | - |
| FindItemLedgEntries | (var Record Item Ledger Entry, Code[20]) | - | public | 17-28 | - | - |
| UpdateSalesOrderLineIfExist | (Code[20]) | - | internal | 22-28 | - | - |
| ErrorHelperHeader | (Enum Correct Sales Inv. Error Type, Record Sales Invoice Header) | - | public | 26-28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnAfterCreateCopyDocument | (var Record Sales Header, var Record Sales Invoice Header) | 17-28 | - | - |
| Integration event | OnAfterTestCorrectInvoiceIsAllowed | (var Record Sales Invoice Header, Boolean) | 17-28 | - | - |
| Integration event | OnAfterTestSalesLineType | (Record Sales Invoice Line, var Boolean) | 17-28 | - | - |
| Integration event | OnAfterCreateCorrSalesInvoice | (var Record Sales Header) | 17-20 | - | - |
| Integration event | OnAfterCreateCorrectiveSalesCrMemo | (Record Sales Invoice Header, var Record Sales Header, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeCreateCorrectiveSalesCrMemo | (Record Sales Invoice Header) | 17-21 | - | - |
| Integration event | OnBeforeCreateCreditMemoCopyDocument | (var Record Sales Invoice Header) | 17-28 | - | - |
| Integration event | OnBeforeSalesHeaderInsert | (var Record Sales Header, var Record Sales Invoice Header, Boolean) | 17-28 | - | - |
| Integration event | OnBeforeSelesHeaderInsert | (var Record Sales Header, var Record Sales Invoice Header, Boolean) | 17 | Pending 15.1 | The event has been replaced with OnBeforeSalesHeaderInsert to fix a typo |
| Integration event | OnBeforeSetTrackInfoForCancellation | (var Record Sales Invoice Header, var Boolean) | 17-28 | - | - |
| Integration event | OnHasLineDiscountSetup | (Record Sales & Receivables Setup, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeTestInventoryPostingSetup | (Record Sales Invoice Line, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeUpdateSalesOrderLineInvoicedQuantity | (var Record Sales Line, Decimal, Decimal, var Boolean) | 17-28 | - | - |
| Integration event | OnCreateCreditMemoOnBeforePageRun | (var Record Sales Header, var Boolean) | 17-28 | - | - |
| Integration event | OnBeforeTestSalesInvoiceHeaderAmount | (var Record Sales Invoice Header, Boolean, var Boolean) | 18-27 | Pending 25.0 | OnBeforeTestSalesInvoiceHeaderAmount is not supported anymore. |
| Integration event | OnBeforeUnapplyCostApplication | (Code[20], var Boolean) | 18-28 | - | - |
| Integration event | OnTestSalesLinesOnAfterCalcShippedQtyNoReturned | (Record Sales Invoice Line, var Decimal) | 18-28 | - | - |
| Integration event | OnAfterUpdateSalesOrderLineInvoicedQuantity | (var Record Sales Line, Decimal, Decimal) | 19-28 | - | - |
| Integration event | OnBeforeTestIfAnyFreeNumberSeries | (var Record Sales Invoice Header, var Boolean) | 19-28 | - | - |
| Integration event | OnOnRunOnAfterUpdateSalesOrderLinesFromCancelledInvoice | (var Record Sales Invoice Header, var Record Sales Header) | 19-28 | - | - |
| Integration event | OnBeforeTestIfInvoiceIsPaid | (var Record Sales Invoice Header, var Boolean) | 19-28 | - | - |
| Integration event | OnAfterIsCommentLine | (Record Sales Invoice Line, var Boolean) | 21-28 | - | - |
| Integration event | OnAfterCreateCorrSalesInvoice | (var Record Sales Header, var Record Sales Invoice Header) | 21-28 | - | - |
| Integration event | OnCreateCorrectiveCreditMemoOnBeforePageRun | (var Record Sales Header, var Boolean) | 21-28 | - | - |
| Integration event | OnBeforeCreateCorrectiveSalesCrMemo | (var Record Sales Invoice Header) | 22-28 | - | - |
| Integration event | OnCreateCreditMemoOnBeforePostedPageRun | (var Record Sales Cr.Memo Header, var Boolean) | 22-28 | - | - |
| Integration event | OnBeforeTestVATPostingSetup | (Record Sales Invoice Line, var Boolean) | 22-28 | - | - |
| Integration event | OnBeforeErrorHelperHeader | (Enum Correct Sales Inv. Error Type, Record Sales Invoice Header, Boolean) | 22-28 | - | - |
| Integration event | OnBeforeTestIfInvoiceIsCorrectedOnce | (var Record Sales Invoice Header, var Boolean) | 22-28 | - | - |
| Integration event | OnBeforeWasNotCancelled | (Code[20], var Boolean, var Boolean) | 22-28 | - | - |
| Integration event | OnRunOnBeforePostCorrectiveSalesCrMemo | (var Record Sales Invoice Header, var Record Sales Header, var Boolean) | 22-23 | - | - |
| Integration event | OnBeforeTestWMSLocation | (var Record Sales Invoice Line, var Boolean) | 22-28 | - | - |
| Integration event | OnBeforeCreateAndProcessJobPlanningLines | (var Record Sales Header, var Boolean) | 23-28 | - | - |
| Integration event | OnTestGenPostingSetupOnBeforeTestTypeItem | (Record Sales Invoice Line, var Boolean) | 23-28 | - | - |
| Integration event | OnRunOnBeforePostCorrectiveSalesCrMemo | (var Record Sales Invoice Header, var Record Sales Header, var Boolean, var Boolean) | 24-28 | - | - |
| Integration event | OnBeforeUpdateSalesOrderLinesFromCancelledInvoice | (Code[20], var Boolean) | 24-28 | - | - |
| Integration event | OnCreateJobPlanningLineOnAfterInitFromJobPlanningLine | (var Record Job Planning Line, Record Job Planning Line, Record Sales Line) | 24-28 | - | - |
| Integration event | OnBeforeTestIfDropShipmentDocument | (var Record Sales Invoice Header, var Boolean) | 28 | - | - |
| Integration event | OnCreateCreditMemoCopyDocumentOnBeforeConfirm | (var Record Sales Invoice Header, var Record Sales Header, var Text) | 28 | - | - |
| Integration event | OnBeforeUpdateSalesOrderLinesFromCreditMemo | (var Record Sales Invoice Line, var Record Sales Cr.Memo Line, var Boolean) | 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.
