Codeunit "Release Sales Document"

ID 414
Namespace: Microsoft.Sales.Document

Releases sales documents for further processing such as shipping, invoicing, or warehouse handling.

Properties

Name Value
TableNo Table Microsoft.Sales.Document."Sales Header"
Permissions TableData "Sales Header" = rm, TableData "Sales Line" = r

Methods

Reopen

Reopens a released or pending prepayment sales document to allow modifications.

procedure Reopen(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to reopen.

PerformManualRelease

Performs a manual release of a sales document with prepayment and approval validation.

procedure PerformManualRelease(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

PerformManualCheckAndRelease

Validates prepayment status and pending approval before releasing the sales document.

procedure PerformManualCheckAndRelease(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to validate and release.

PerformManualReopen

Performs a manual reopen of a sales document with approval status validation.

procedure PerformManualReopen(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to reopen.

ReleaseSalesHeader

Releases a sales header with optional preview mode for posting preview scenarios.

procedure ReleaseSalesHeader(var SalesHdr: Record "Sales Header"; Preview: Boolean): Boolean

Parameters

Name Type Description
SalesHdr Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

Preview Boolean

True to run in preview mode without committing changes.

Returns

Type Description
Boolean

True if lines were modified during release; otherwise, false.

SetSkipCheckReleaseRestrictions

Skips checking release restrictions during the release process.

procedure SetSkipCheckReleaseRestrictions()

SetSkipWhseRequestOperations

Specifies whether to skip warehouse request operations during release and reopen.

procedure SetSkipWhseRequestOperations(NewSkipWhseRequestOperations: Boolean)

Parameters

Name Type Description
NewSkipWhseRequestOperations Boolean

True to skip warehouse request operations; false to process them.

CalcAndUpdateVATOnLines

Calculates and updates VAT amounts on all sales lines for the document.

procedure CalcAndUpdateVATOnLines(var SalesHeader: Record "Sales Header"; var SalesLine: Record "Sales Line"): Boolean

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header for VAT calculation.

SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales lines to update with calculated VAT.

Returns

Type Description
Boolean

True if lines were modified; otherwise, false.

Events

OnBeforeCalcInvDiscount

Raised before calculating the invoice discount for a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeCalcInvDiscount(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var LinesWereModified: Boolean; var SalesLine: Record "Sales Line"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header for which to calculate the discount.

PreviewMode Boolean

Indicates if running in preview mode.

LinesWereModified Boolean

Indicates if sales lines were modified.

SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales lines for the document.

IsHandled Boolean

Set to true to skip the default discount calculation.

OnBeforeManualReleaseSalesDoc

Raised before manually releasing a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeManualReleaseSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

PreviewMode Boolean

Indicates if running in preview mode.

OnBeforeTestSellToCustomerNo

Raised before testing the Sell-to Customer No. field on the sales header.

[IntegrationEvent(False,False)]
local procedure OnBeforeTestSellToCustomerNo(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to validate.

IsHandled Boolean

Set to true to skip the default validation.

OnBeforeOnRun

Raised before the OnRun trigger executes for the Release Sales Document codeunit.

[IntegrationEvent(False,False)]
local procedure OnBeforeOnRun(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being processed.

OnBeforeReleaseSalesDoc

Raised before releasing a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeReleaseSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean; var SkipCheckReleaseRestrictions: Boolean; SkipWhseRequestOperations: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default release logic.

SkipCheckReleaseRestrictions Boolean

Set to true to skip release restriction checks.

SkipWhseRequestOperations Boolean

Indicates if warehouse request operations should be skipped.

OnAfterReleaseSalesDoc

Raised after releasing a sales document.

[IntegrationEvent(False,False)]
local procedure OnAfterReleaseSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var LinesWereModified: Boolean; SkipWhseRequestOperations: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The released sales header.

PreviewMode Boolean

Indicates if running in preview mode.

LinesWereModified Boolean

Indicates if sales lines were modified during release.

SkipWhseRequestOperations Boolean

Indicates if warehouse request operations were skipped.

OnAfterManualReleaseSalesDoc

Raised after manually releasing a sales document.

[IntegrationEvent(False,False)]
local procedure OnAfterManualReleaseSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The released sales header.

PreviewMode Boolean

Indicates if running in preview mode.

OnBeforeCheckSalesHeaderPendingApproval

Raised before checking if a sales header has pending approval.

[IntegrationEvent(False,False)]
local procedure OnBeforeCheckSalesHeaderPendingApproval(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to check.

IsHandled Boolean

Set to true to skip the default approval check.

OnBeforeCheckSalesLines

Raised before checking sales lines during document release.

[IntegrationEvent(False,False)]
local procedure OnBeforeCheckSalesLines(var SalesHeader: Record "Sales Header"; var SalesLine: Record "Sales Line"; var IsHandled: Boolean; var LinesWereModified: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales lines to check.

IsHandled Boolean

Set to true to skip the default sales line check.

LinesWereModified Boolean

Indicates if sales lines were modified.

OnBeforeManualReOpenSalesDoc

Raised before manually reopening a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeManualReOpenSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to reopen.

PreviewMode Boolean

Indicates if running in preview mode.

OnBeforeReopenSalesDoc

Raised before reopening a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeReopenSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean; SkipWhseRequestOperations: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to reopen.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default reopen logic.

SkipWhseRequestOperations Boolean

Indicates if warehouse request operations should be skipped.

OnBeforeModifySalesDoc

Raised before modifying the sales document during the release process.

[IntegrationEvent(False,False)]
local procedure OnBeforeModifySalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being modified.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default modification.

OnBeforePerformManualRelease

Raised before performing the manual release of a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforePerformManualRelease(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default manual release.

OnBeforePerformManualReleaseProcedure

Raised before the PerformManualRelease procedure executes.

[IntegrationEvent(False,False)]
local procedure OnBeforePerformManualReleaseProcedure(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default procedure execution.

OnBeforeSalesLineFind

Raised before finding sales lines during document release validation.

[IntegrationEvent(False,False)]
local procedure OnBeforeSalesLineFind(var SalesLine: Record "Sales Line"; var SalesHeader: Record "Sales Header"; var LinesWereModified: Boolean; var IsHandled: Boolean)

Parameters

Name Type Description
SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales line record with filters applied.

SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

LinesWereModified Boolean

Indicates if sales lines were modified.

IsHandled Boolean

Set to true to skip the default sales line finding.

OnAfterReopenSalesDoc

Raised after reopening a sales document.

[IntegrationEvent(False,False)]
local procedure OnAfterReopenSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; SkipWhseRequestOperations: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The reopened sales header.

PreviewMode Boolean

Indicates if running in preview mode.

SkipWhseRequestOperations Boolean

Indicates if warehouse request operations were skipped.

OnAfterManualReOpenSalesDoc

Raised after manually reopening a sales document.

[IntegrationEvent(False,False)]
local procedure OnAfterManualReOpenSalesDoc(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The reopened sales header.

PreviewMode Boolean

Indicates if running in preview mode.

OnAfterPerformManualCheckAndRelease

Raised after performing the manual check and release of a sales document.

[IntegrationEvent(False,False)]
local procedure OnAfterPerformManualCheckAndRelease(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The released sales header.

PreviewMode Boolean

Indicates if running in preview mode.

OnAfterReleaseATOs

Raised after releasing assemble-to-order documents for the sales document.

[IntegrationEvent(False,False)]
local procedure OnAfterReleaseATOs(var SalesHeader: Record "Sales Header"; var SalesLine: Record "Sales Line"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales lines with assemble-to-order items.

PreviewMode Boolean

Indicates if running in preview mode.

OnAfterUpdateSalesDocLines

Raised after updating sales document lines during the release process.

[IntegrationEvent(False,False)]
local procedure OnAfterUpdateSalesDocLines(var SalesHeader: Record "Sales Header"; var LinesWereModified: Boolean; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

LinesWereModified Boolean

Indicates if sales lines were modified.

PreviewMode Boolean

Indicates if running in preview mode.

OnCodeOnAfterCheck

Raised after checking the sales document during the release process.

[IntegrationEvent(False,False)]
local procedure OnCodeOnAfterCheck(SalesHeader: Record "Sales Header"; var SalesLine: Record "Sales Line"; var LinesWereModified: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales lines that were checked.

LinesWereModified Boolean

Indicates if sales lines were modified.

OnCodeOnAfterSalesLineCheck

Raised after checking a sales line during mandatory field validation.

[IntegrationEvent(False,False)]
local procedure OnCodeOnAfterSalesLineCheck(var SalesLine: Record "Sales Line"; var SalesHeader: Record "Sales Header"; var Item: Record Item)

Parameters

Name Type Description
SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales line that was checked.

SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

Item Table Microsoft.Inventory.Item.Item

The item on the sales line.

OnCodeOnBeforeSalesLineCheck

Raised before checking a sales line during mandatory field validation.

[IntegrationEvent(False,False)]
local procedure OnCodeOnBeforeSalesLineCheck(var SalesLine: Record "Sales Line"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales line to check.

IsHandled Boolean

Set to true to skip the default sales line check.

OnCodeOnAfterCalcShouldSetStatusPrepayment

Raised after calculating whether to set the status to Pending Prepayment.

[IntegrationEvent(False,False)]
local procedure OnCodeOnAfterCalcShouldSetStatusPrepayment(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var ShouldSetStatusPrepayment: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

PreviewMode Boolean

Indicates if running in preview mode.

ShouldSetStatusPrepayment Boolean

Set to control whether the status should be set to Pending Prepayment.

OnCodeOnCheckTracking

Raised when checking item tracking during the release process.

[IntegrationEvent(False,False)]
local procedure OnCodeOnCheckTracking(SalesHeader: Record "Sales Header"; var SalesLine: Record "Sales Line")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

SalesLine Table Microsoft.Sales.Document."Sales Line"

The sales lines to check for item tracking.

OnBeforeCheckCustomerCreated

Raised before checking if a customer was created from a quote.

[IntegrationEvent(False,False)]
local procedure OnBeforeCheckCustomerCreated(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to check.

IsHandled Boolean

Set to true to skip the default customer creation check.

OnBeforeCheckReopenStatus

Raised before checking the status when reopening a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeCheckReopenStatus(SalesHeader: Record "Sales Header"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to check.

IsHandled Boolean

Set to true to skip the default status check.

OnBeforePerformManualCheckAndRelease

Raised before performing the manual check and release of a sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforePerformManualCheckAndRelease(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header to release.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default check and release logic.

OnReopenOnBeforeSalesHeaderModify

Raised before modifying the sales header during the reopen process.

[IntegrationEvent(False,False)]
local procedure OnReopenOnBeforeSalesHeaderModify(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being reopened.

OnPerformManualReleaseOnBeforeTestSalesPrepayment

Raised before testing for sales prepayment during manual release.

[IntegrationEvent(False,False)]
local procedure OnPerformManualReleaseOnBeforeTestSalesPrepayment(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip the default prepayment test.

OnPerformManualCheckAndReleaseOnBeforeSalesHeaderModify

Raised before modifying the sales header during manual check and release.

[IntegrationEvent(False,False)]
local procedure OnPerformManualCheckAndReleaseOnBeforeSalesHeaderModify(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being modified.

PreviewMode Boolean

Indicates if running in preview mode.

OnCodeOnAfterCheckCustomerCreated

Raised after checking if a customer was created from a quote.

[IntegrationEvent(False,False)]
local procedure OnCodeOnAfterCheckCustomerCreated(var SalesHeader: Record "Sales Header"; PreviewMode: Boolean; var IsHandled: Boolean; var LinesWereModified: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header that was checked.

PreviewMode Boolean

Indicates if running in preview mode.

IsHandled Boolean

Set to true to skip further processing.

LinesWereModified Boolean

Indicates if sales lines were modified.

OnCodeOnAfterModifySalesDoc

Raised after modifying the sales document during the release process.

[IntegrationEvent(False,False)]
local procedure OnCodeOnAfterModifySalesDoc(var SalesHeader: Record "Sales Header"; var LinesWereModified: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header that was modified.

LinesWereModified Boolean

Indicates if sales lines were modified.

OnBeforeCheckMandatoryFields

Raised before checking mandatory fields on sales lines.

[IntegrationEvent(False,False)]
local procedure OnBeforeCheckMandatoryFields(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

IsHandled Boolean

Set to true to skip the default mandatory field check.

OnCodeOnBeforeSetStatusReleased

Raised before setting the sales document status to Released.

[IntegrationEvent(False,False)]
local procedure OnCodeOnBeforeSetStatusReleased(var SalesHeader: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

OnBeforeReleaseATOs

Raised before releasing assemble-to-order documents for the sales document.

[IntegrationEvent(False,False)]
local procedure OnBeforeReleaseATOs(var SalesHeader: Record "Sales Header"; var IsHandled: Boolean)

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The sales header being released.

IsHandled Boolean

Set to true to skip the default ATO release logic.

OnRunOnAfterCopy

Raised after copying the sales header in the OnRun trigger.

[IntegrationEvent(False,False)]
local procedure OnRunOnAfterCopy(var SalesHeader: Record "Sales Header"; var SalesHeaderCopy: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The original sales header passed to OnRun.

SalesHeaderCopy Table Microsoft.Sales.Document."Sales Header"

The copy of the sales header being processed.

OnReleaseSalesHeaderOnAfterCopySalesHeader

Raised after copying the sales header in the ReleaseSalesHeader procedure.

[IntegrationEvent(False,False)]
local procedure OnReleaseSalesHeaderOnAfterCopySalesHeader(var SalesHeader: Record "Sales Header"; var SalesHeaderCopy: Record "Sales Header")

Parameters

Name Type Description
SalesHeader Table Microsoft.Sales.Document."Sales Header"

The original sales header passed to ReleaseSalesHeader.

SalesHeaderCopy Table Microsoft.Sales.Document."Sales Header"

The copy of the sales header being processed.

See also