{"title":"Codeunit 8063 Sales Documents, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/8063-sales-documents/points/","author":"JOP-AL","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/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":8063,"name":"Sales Documents","app":"Subscription Billing","url":"https://jonas-paprotka.de/ref/codeunit/8063-sales-documents/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/8063-sales-documents/source/","path":"src/Apps/W1/Subscription Billing/App/Billing/Codeunits/SalesDocuments.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"table:37":{"name":"Sales Line","url":"https://jonas-paprotka.de/ref/table/37-sales-line/"},"table:8061":{"name":"Billing Line","url":"https://jonas-paprotka.de/ref/table/8061-billing-line/"},"table:8064":{"name":"Billing Line Archive","url":"https://jonas-paprotka.de/ref/table/8064-billing-line-archive/"},"table:8006":{"name":"Usage Data Billing","url":"https://jonas-paprotka.de/ref/table/8006-usage-data-billing/"},"codeunit:8069":{"name":"Sales Subscription Line Mgmt.","url":"https://jonas-paprotka.de/ref/codeunit/8069-sales-subscription-line-mgmt/"},"table:8057":{"name":"Subscription Header","url":"https://jonas-paprotka.de/ref/table/8057-subscription-header/"},"codeunit:6503":{"name":"Item Tracking Doc. Management","url":"https://jonas-paprotka.de/ref/codeunit/6503-item-tracking-doc-management/"},"table:27":{"name":"Item","url":"https://jonas-paprotka.de/ref/table/27-item/"},"codeunit:8003":{"name":"Sub. Contract Renewal Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/8003-sub-contract-renewal-mgt/"},"table:8068":{"name":"Sales Subscription Line","url":"https://jonas-paprotka.de/ref/table/8068-sales-subscription-line/"},"table:8059":{"name":"Subscription Line","url":"https://jonas-paprotka.de/ref/table/8059-subscription-line/"}},"procs":[{"name":"DeleteAllTempSubscriptionItemSalesLines","line":34,"kind":"procedure","access":"local","params":0,"steps":[[37,"write",37,"DeleteAll"]]},{"name":"SalesHeaderOnBeforeDeleteEvent","line":41,"kind":"procedure","access":"local","params":2,"steps":[[56,"call","GetAppliesToDocNo",1],[63,"call","ResetServiceCommitmentAndDeleteBillingLinesForCreditMemoSalesLine",1],[66,"call","AutoResetServiceCommitmentAndDeleteBillingLinesForSalesDocument",1],[71,"call","ResetServiceCommitmentAndDeleteAllBillingLinesForDocument",1],[76,"call","ResetSalesDocumentFieldsForBillingLines",1]]},{"name":"SalesLineOnAfterDeleteEvent","line":81,"kind":"procedure","access":"local","params":2,"steps":[[105,"call","GetAppliesToDocNo",1],[108,"call","ResetServiceCommitmentAndDeleteBillingLinesForCreditMemoSalesLine",1],[110,"call","AutoResetServiceCommitmentAndDeleteBillingLinesForSalesDocument",1],[111,"call","ResetServiceCommitmentAndDeleteAllBillingLinesForDocument",1],[113,"call","FilterBillingLinePerSalesLine",2],[114,"call","ResetSalesDocumentFieldsForBillingLines",1]]},{"name":"SetVATProductPostingGroupInContractRenewalLineOnAfterAssignFieldsForNo","line":119,"kind":"procedure","access":"local","params":1,"steps":[[125,"ext","table",37,"IsLineWithServiceObject",0],[137,"validate",37,"VAT Prod. Posting Group"],[139,"validate",37,"Tax Group Code"],[145,"validate",37,"VAT Prod. Posting Group"],[147,"validate",37,"Tax Group Code"]]},{"name":"ResetServiceCommitmentAndDeleteBillingLinesForCreditMemoSalesLine","line":152,"kind":"procedure","access":"local","params":1,"steps":[[156,"call","FilterBillingLinePerSalesLine",2],[158,"ext","table",8061,"FindFirstBillingLineForServiceCommitment",1],[159,"ext","table",8061,"ResetServiceCommitmentNextBillingDate",0],[160,"write",8061,"DeleteAll"]]},{"name":"FilterBillingLinePerSalesLine","line":164,"kind":"procedure","access":"local","params":2,"steps":[[166,"ext","table",8061,"FilterBillingLineOnDocumentLine",3],[166,"ext","table",8061,"GetBillingDocumentTypeFromSalesDocumentType",1]]},{"name":"ResetSalesDocumentFieldsForBillingLines","line":169,"kind":"procedure","access":"local","params":1,"steps":[[172,"write",8061,"ModifyAll"],[174,"write",8061,"ModifyAll"],[175,"write",8061,"ModifyAll"]]},{"name":"SalesPostOnBeforeSalesLineDeleteAll","line":180,"kind":"procedure","access":"local","params":5,"steps":[[194,"call","FilterBillingLinePerSalesLine",2],[195,"call","MoveBillingLineToBillingLineArchive",4],[196,"write",8061,"DeleteAll"]]},{"name":"MoveBillingLineToBillingLineArchive","line":200,"kind":"procedure","access":"local","params":4,"steps":[[218,"write",8064,"Insert"],[220,"write",8006,"ModifyAll"],[221,"event","OnAfterInsertBillingLineArchiveOnMoveBillingLineToBillingLineArchive",0]]},{"name":"MoveBillingLineToBillingLineArchiveForPostingPreview","line":225,"kind":"procedure","access":"internal","params":1,"steps":[[233,"event","OnBeforeMoveBillingLineToBillingLineArchiveForPostingPreview",1],[237,"call","SalesPostOnBeforeSalesLineDeleteAll",5]]},{"name":"ValidateQuantityOnSalesLineOnBeforeInsertSalesOrderLine","line":241,"kind":"procedure","access":"local","params":1,"steps":[[243,"ext","codeunit",8069,"IsSalesLineWithSalesServiceCommitmentsToShip",1],[244,"validate",37,"Quantity"]]},{"name":"BlanketSalesOrderToOrderValidateQuantityOnSalesLineOnBeforeInsertSalesOrderLine","line":248,"kind":"procedure","access":"local","params":1,"steps":[[250,"ext","codeunit",8069,"IsSalesLineWithSalesServiceCommitmentsToShip",1],[251,"validate",37,"Quantity"]]},{"name":"ClearQtyToInvoiceForServiceCommitmentItemAfterValidateEventQtyToInvoice","line":255,"kind":"procedure","access":"local","params":1,"steps":[[257,"call","ClearQtyToInvoiceOnForServiceCommitmentItem",1]]},{"name":"ClearQtyToInvoiceForServiceCommitmentItemAfterInitQtyToInvoice","line":261,"kind":"procedure","access":"local","params":1,"steps":[[263,"call","ClearQtyToInvoiceOnForServiceCommitmentItem",1]]},{"name":"ClearQtyToInvoiceOnForServiceCommitmentItem","line":266,"kind":"procedure","access":"local","params":1,"steps":[[270,"event","OnBeforeClearQtyToInvoiceOnForSubscriptionItem",1],[274,"ext","codeunit",8069,"IsSalesLineWithServiceCommitmentItem",2]]},{"name":"ResetValueForServiceCommitmentItemsBeforePosting","line":282,"kind":"procedure","access":"local","params":1,"steps":[[286,"call","DeleteAllTempSubscriptionItemSalesLines",0],[289,"call","CheckResetValueForServiceCommitmentItems",1],[291,"write",37,"Insert"],[297,"ext","table",37,"UpdateAmounts",0],[298,"write",37,"Modify"]]},{"name":"RestoreValueForServiceCommitmentItemsAfterPosting","line":304,"kind":"procedure","access":"local","params":2,"steps":[[314,"ext","table",37,"UpdateAmounts",0],[315,"write",37,"Modify"]]},{"name":"SkipInitializingPostingNo","line":319,"kind":"procedure","access":"local","params":2,"steps":[[323,"call","AllSalesLinesAreServiceCommitmentItems",1]]},{"name":"SkipInsertingSalesInvoiceHeaderIfOnlyServiceCommitmentItemsExist","line":328,"kind":"procedure","access":"local","params":6,"steps":[[332,"call","AllSalesLinesAreServiceCommitmentItems",1]]},{"name":"SkipInsertingSalesInvoiceLineIfServiceCommitmentItemsExist","line":337,"kind":"procedure","access":"local","params":3,"steps":[[344,"call","SalesLineShouldSkipInvoicing",1],[347,"call","SalesLineShouldSkipInvoicing",1],[348,"event","OnAfterSkipInsertingSalesInvoiceLineIfServiceCommitmentItemsExist",1]]},{"name":"CreateSubscriptionHeaderFromItemJournalLine","line":366,"kind":"procedure","access":"local","params":1,"steps":[[374,"ext","codeunit",8069,"IsSalesLineWithSalesServiceCommitments",2],[377,"call","ShowNegativeQuantityMessageIfNeeded",1],[378,"call","ResetGlobalVariables",0],[383,"call","CreateServiceObjectFromSalesLine",5],[387,"write",8057,"ModifyAll"]]},{"name":"CloseSalesOrderLineOnDropShipmentAssocOrderUpdate","line":392,"kind":"procedure","access":"local","params":1,"steps":[[394,"call","SalesLineShouldSkipInvoicing",1],[397,"call","SetSubscriptionItemLineAsInvoiced",1]]},{"name":"CreateServiceObjectFromSales","line":413,"kind":"procedure","params":3,"steps":[[420,"ext","codeunit",8069,"IsSalesLineWithSalesServiceCommitmentsToShip",1],[422,"call","ShowNegativeQuantityMessageIfNeeded",1],[423,"call","ResetGlobalVariables",0],[427,"ext","codeunit",6503,"RetrieveDocumentItemTracking",4],[431,"call","CreateServiceObjectFromSalesLine",5],[436,"ext","table",27,"HasSNSpecificItemTracking",0],[437,"call","CreateServiceObjectFromSalesLine",5]]},{"name":"UpdateQuantitiesOnPostUpdateOrderLineOnSetDefaultQtyBlank","line":443,"kind":"procedure","access":"local","params":1,"steps":[[448,"call","SalesLineShouldSkipInvoicing",2],[449,"event","OnUpdateQuantitiesOnPostUpdateOrderLineOnSetDefaultQtyBlankOnAfterCalcShouldModifySalesLine",0],[453,"call","SetSubscriptionItemLineAsInvoiced",1]]},{"name":"UpdateInvoicedQtyOnShipmentLineOnBeforeModifySalesShptLine","line":457,"kind":"procedure","access":"local","params":2,"steps":[[460,"call","SalesLineShouldSkipInvoicing",1]]},{"name":"SetQtyToInvoiceToZeroOnBeforePostUpdateOrderLineModifyTempLine","line":469,"kind":"procedure","access":"local","params":1,"steps":[[477,"call","SalesLineShouldSkipInvoicing",2],[478,"event","OnSetQtyToInvoiceToZeroOnBeforePostUpdateOrderLineModifyTempLineOnAfterCalcShouldModifySalesLine",0],[487,"ext","table",37,"UpdateAmounts",0],[490,"validate",37,"Qty. to Invoice"]]},{"name":"CheckResetValueForServiceCommitmentItems","line":528,"kind":"procedure","access":"local","params":1,"steps":[[534,"event","OnCheckResetValueForSubscriptionItems",1],[537,"ext","codeunit",8069,"IsSalesLineWithServiceCommitmentItem",2],[537,"ext","codeunit",8003,"IsContractRenewal",1]]},{"name":"CreateServiceObjectFromSalesLine","line":540,"kind":"procedure","access":"local","params":5,"steps":[[546,"event","OnBeforeCreateSubscriptionHeaderFromSalesLine",1],[551,"call","CreateServiceObject",6],[553,"call","CreateServiceObject",6],[555,"call","CreateSubscriptionLineFromSalesLine",3],[556,"event","OnAfterCreateSubscriptionHeaderFromSalesLine",0]]},{"name":"CreateServiceObject","line":559,"kind":"procedure","access":"local","params":6,"steps":[[564,"ext","table",8057,"SetHideValidationDialog",1],[567,"validate",8057,"Description"],[568,"validate",8057,"Quantity"],[571,"validate",8057,"Unit of Measure"],[573,"validate",8057,"Provision Start Date"],[574,"validate",8057,"End-User Contact No."],[575,"validate",8057,"End-User Customer No."],[602,"ext","table",8057,"UpdateVendorAndManufacturerFromItem",1],[607,"event","OnCreateSubscriptionHeaderFromSalesLineBeforeInsertSubscriptionHeader",0],[608,"write",8057,"Insert",1],[609,"event","OnCreateSubscriptionHeaderFromSalesLineAfterInsertSubscriptionHeader",0]]},{"name":"CreateSubscriptionLineFromSalesLine","line":612,"kind":"procedure","params":3,"steps":[[617,"ext","table",8068,"FilterOnSalesLine",1],[626,"validate",8059,"Subscription Line Start Date"],[629,"validate",8059,"Subscription Line Start Date"],[631,"validate",8059,"Subscription Line Start Date"],[632,"ext","table",8059,"CopyFromSalesServiceCommitment",1],[633,"ext","table",8059,"EnsureCalculationBaseAmountExcludesVAT",2],[635,"validate",8059,"Calculation Base Amount"],[637,"ext","table",8059,"UpdateNextPriceUpdate",0],[638,"ext","table",8059,"CalculateSubscriptionDates",0],[639,"ext","table",8059,"SetCurrencyData",3],[640,"ext","table",8059,"SetLCYFields",1],[646,"ext","table",8059,"SetDefaultDimensions",1],[647,"ext","table",8059,"GetCombinedDimensionSetID",2],[650,"event","OnCreateSubscriptionHeaderFromSalesLineBeforeInsertSubscriptionLine",0],[651,"ext","table",8059,"CalculateServiceAmount",1],[652,"write",8059,"Insert"],[653,"event","OnCreateSubscriptionHeaderFromSalesLineAfterInsertSubscriptionLine",0]]},{"name":"AllSalesLinesAreServiceCommitmentItems","line":657,"kind":"procedure","params":1,"steps":[[667,"ext","codeunit",8069,"IsSalesLineWithServiceCommitmentItem",2]]},{"name":"ResetServiceCommitmentAndDeleteAllBillingLinesForDocument","line":687,"kind":"procedure","access":"local","params":1,"steps":[[691,"call","FilterBillingLinePerSalesLine",2],[693,"ext","table",8061,"ResetServiceCommitmentNextBillingDate",0],[694,"write",8061,"DeleteAll"]]},{"name":"ModifyShipmentDateFromInventoryPickPostingDate","line":699,"kind":"procedure","access":"local","params":2,"steps":[[709,"ext","codeunit",8069,"IsSalesLineWithSalesServiceCommitmentsToShip",1],[713,"write",37,"Modify"]]},{"name":"TransferRecurringBillingMark","line":718,"kind":"procedure","access":"local","params":2,"steps":[[724,"call","GetRecurringBillingField",2]]},{"name":"SalesInvLineCopyContractNoOnAfterInitFromSalesLine","line":763,"kind":"procedure","access":"local","params":3,"steps":[[767,"ext","table",8061,"FilterBillingLineOnDocumentLine",3],[767,"ext","table",8061,"GetBillingDocumentTypeFromSalesDocumentType",1]]},{"name":"SalesCrMemoLineCopyContractNoOnAfterInitFromSalesLine","line":775,"kind":"procedure","access":"local","params":3,"steps":[[779,"ext","table",8061,"FilterBillingLineOnDocumentLine",3],[779,"ext","table",8061,"GetBillingDocumentTypeFromSalesDocumentType",1]]},{"name":"IsInvoiceCredited","line":791,"kind":"procedure","access":"internal","params":1,"steps":[[797,"ext","table",8064,"IsInvoiceCredited",2]]},{"name":"GetAppliesToDocNo","line":800,"kind":"procedure","access":"internal","params":1,"steps":[[806,"ext","table",8061,"GetCorrectionDocumentNo",2]]},{"name":"RevertInvoicedQuantityOnUpdateSalesLineOnBeforeSalesLineModify","line":810,"kind":"procedure","access":"local","params":1,"steps":[[814,"ext","codeunit",8069,"IsSalesLineWithServiceCommitmentItemToShip",1],[815,"event","OnRevertInvoicedQuantityOnUpdateSalesLineOnBeforeSalesLineModifyOnAfterCalcShouldModifySalesLine",0]]},{"name":"ClearQtyToInvoiceInSalesLineForServiceCommitmentItem","line":824,"kind":"procedure","access":"local","params":12,"steps":[[830,"ext","table",37,"IsSalesDocumentTypeWithServiceCommitments",0],[835,"ext","table",27,"IsServiceCommitmentItem",0]]},{"name":"UpdateInvoicedQtyOnSalesLineAfterUndoShipment","line":843,"kind":"procedure","access":"local","params":1,"steps":[[845,"ext","codeunit",8069,"IsSalesLineWithServiceCommitmentItem",2]]},{"name":"SalesLineShouldSkipInvoicing","line":857,"kind":"procedure","params":2,"steps":[[859,"ext","codeunit",8069,"IsSalesLineWithServiceCommitmentItem",2],[861,"event","OnAfterSalesLineShouldSkipInvoicing",0]]},{"name":"ResetVariablesOnBeforePostSalesDoc","line":895,"kind":"procedure","access":"local","params":0,"steps":[[897,"call","ResetGlobalVariables",0]]},{"name":"ResetVariablesOnAfterPostSalesDoc","line":901,"kind":"procedure","access":"local","params":0,"steps":[[903,"call","ResetGlobalVariables",0]]}]}