Table of Contents

KVSKBAReleaseSalesDocument

Summary: Handles Business Central events for Release Sales Document, including On Manual Release Or Send For Approval, Send Sales Document For Approval, and On Before Calculation Sales Discount.

Events

OnAfterOnManualReleaseOrSendForApproval(Record Sales Header, Boolean) :

Summary: Integration event raised after manual release or sending for approval processing completes.

[IntegrationEvent(false, false)]
local procedure OnAfterOnManualReleaseOrSendForApproval(var SalesHeader: Record "Sales Header"; CalledOnSendingForApproval: Boolean): 

Parameters:

  • SalesHeader: The sales header record that was processed.
  • CalledOnSendingForApproval: TRUE if called during approval request, FALSE if called during manual release.

Remarks: Allows subscribers to: - Perform additional validations after standard checks - Update custom fields or related records - Execute custom business logic before actual release - Log or audit release/approval actions

         Called after:
         - Position numbers are calculated
         - Unit prices are updated
         - Invoice discounts are recalculated
         - Mandatory fields are validated
        
         Only triggered for documents with Status = Open or Pending Prepayment.

OnBeforeOnManualReleaseOrSendForApproval(Record Sales Header, Boolean, Boolean) :

Summary: Integration event raised before manual release or sending for approval processing starts.

[IntegrationEvent(false, false)]
local procedure OnBeforeOnManualReleaseOrSendForApproval(var SalesHeader: Record "Sales Header"; CalledOnSendingForApproval: Boolean; var IsHandled: Boolean): 

Parameters:

  • SalesHeader: The sales header record to be processed.
  • CalledOnSendingForApproval: TRUE if called during approval request, FALSE if called during manual release.
  • IsHandled: Set to TRUE to skip standard processing.

Remarks: Allows subscribers to: - Override standard release/approval logic by setting IsHandled to TRUE - Perform custom pre-validations - Implement alternative processing logic - Add custom checks before price calculations

         If IsHandled is set to TRUE, all standard processing is skipped:
         - Position number calculation
         - Unit price updates
         - Invoice discount recalculation
         - Mandatory field validation
        
         Called after status check but before any processing begins.

OnManualReleaseOrSendForApprovalOnBeforeUpdateSalesDocLinesUnitPrice(Record Sales Header, Boolean, Boolean) :

Summary: Integration event raised before updating unit prices in sales document lines.

[IntegrationEvent(false, false)]
local procedure OnManualReleaseOrSendForApprovalOnBeforeUpdateSalesDocLinesUnitPrice(var SalesHeader: Record "Sales Header"; var MustCalcInvoiceDiscount: Boolean; var IsHandled: Boolean): 

Parameters:

  • SalesHeader: The sales header record being processed.
  • MustCalcInvoiceDiscount: Set to TRUE if invoice discount must be recalculated after price update.
  • IsHandled: Set to TRUE to skip standard unit price update logic.

Remarks: Allows subscribers to: - Override standard unit price update by setting IsHandled to TRUE - Implement custom pricing logic - Control invoice discount recalculation by setting MustCalcInvoiceDiscount - Add custom checks before price updates

         If IsHandled is set to TRUE:
         - Standard UpdateSalesDocLinesUnitPrice is skipped
         - MustCalcInvoiceDiscount must be set appropriately by subscriber
        
         Called after position numbers are calculated but before unit price updates.
         Only triggered for non-return/credit memo documents with Status = Open.