KVSKBASalesContractManagement#
Procedures#
ReleaseContract(Record KVSKBASalesContractHeader) :#
Summary: Releases a sales contract, making it effective and ready for use in sales documents.
procedure ReleaseContract(var SalesContractHeader: Record "KVSKBASalesContractHeader"):
Parameters:
SalesContractHeader: The sales contract header to be released
Remarks: This procedure changes the contract status from Open to Released after validating all contract lines. It checks each line for required fields, blocking flags, variant codes, and data consistency. Only released contracts can be assigned to sales documents. The OnBeforeReleaseContract and OnAfterReleaseContract events allow customization. If the contract is already released, the procedure exits without changes. This is a key step in the contract lifecycle, activating contracts for operational use. Position numbering is performed if necessary before release.
CheckSalesLineContractLine(Record Sales Header, Record Sales Line, Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine, Boolean) :#
Summary: Validates that a sales line's data is compatible with its assigned contract header and line.
procedure CheckSalesLineContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; SalesContractHeader: Record "KVSKBASalesContractHeader"; SalesContractLine: Record "KVSKBASalesContractLine"; CheckonPosting: Boolean):
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line with contract assignment to validateSalesContractHeader: The contract header assigned to the lineSalesContractLine: The contract line assigned to the sales lineCheckonPosting: Indicates whether the check is executed during posting
Remarks: This procedure performs comprehensive validation that a sales line matches its assigned contract. It verifies: contract status (must be Released, not Finished), customer matches bill-to customer or hierarchy, currency matches, validity dates cover order/posting date, item/resource/variant matches, unit of measure is compatible, and location is valid. Called when manually assigning contracts, validating UoM changes, creating orders from quotes, and during posting. OnBeforeCheckSalesLineContractLine and OnAfterCheckSalesLineContractLine events allow customization. Prevents using contracts in blanket orders. This is critical validation ensuring contract applicability to sales documents.
ContractCheckSalesLinesFromQuote(Record Sales Header, Record Sales Line) :#
Summary: Checks contract header and line with sales document data
procedure ContractCheckSalesLinesFromQuote(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"):
Parameters:
SalesHeader: Specifies the sales header that contains the data for checking the contracts.SalesLine: Specifies the sales line that contains the data for checking the contracts.
Remarks: This procedure validates contract validity when creating order/invoice lines from a quote. It ensures the contract exists, is not finished, and the contract line is valid by calling CheckSalesLineContractLine. Only processes Order and Invoice document types. Prevents converting quotes with invalid contract references. Called during quote-to-order/invoice conversion.
Events#
OnAfterCheckContractLineOnFinishing(Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine) :#
Summary: Integration event raised after a contract line has been validated during contract finishing.
[IntegrationEvent(false, false)]
local procedure OnAfterCheckContractLineOnFinishing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterCheckContractLineOnFinishing', '', false, false)]
local procedure DoSomethingOnAfterCheckContractLineOnFinishing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine")
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header being finishedKVSKBASalesContractLine: The validated sales contract line
Remarks: This event is triggered after the CheckContractLineOnFinishing procedure completes its validations when finishing a contract. Subscribe to this event to add custom validations or post-processing logic after checking whether a contract line can be finished. The event is raised for each contract line during the finish process. Useful for extending validation rules, logging finish operations, or performing additional checks on line data before the contract is marked as finished.
OnAfterCheckContractLineOnReleasing(Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine) :#
Summary: Integration event raised after a contract line has been validated during contract releasing.
[IntegrationEvent(false, false)]
local procedure OnAfterCheckContractLineOnReleasing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterCheckContractLineOnReleasing', '', false, false)]
local procedure DoSomethingOnAfterCheckContractLineOnReleasing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine")
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header being releasedKVSKBASalesContractLine: The validated sales contract line
Remarks: This event is triggered after the CheckContractLineOnReleasing procedure completes its validations when releasing a contract. Subscribe to this event to add custom validations or post-processing logic after checking whether a contract line can be released. The event is raised for each contract line during the release process. Useful for extending validation rules for specific line types, checking custom fields, or performing additional business logic before the contract becomes effective.
OnAfterCheckSalesLineContractLine(Record Sales Header, Record Sales Line, Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised after checking a sales line against its assigned contract.
[IntegrationEvent(false, false)]
local procedure OnAfterCheckSalesLineContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; OnPosting: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterCheckSalesLineContractLine', '', false, false)]
local procedure DoSomethingOnAfterCheckSalesLineContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; OnPosting: Boolean)
begin
end;
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line being checkedKVSKBASalesContractHeader: The contract header assigned to the lineKVSKBASalesContractLine: The contract line assigned to the sales lineOnPosting: Indicates whether check is executed during posting
Remarks: This event is triggered after the CheckSalesLineContractLine procedure validates that a sales line's data matches its assigned contract header and line. Subscribe to this event to add custom checks for contract compatibility, validate additional fields, or perform post-validation processing. The OnPosting parameter indicates context (validation vs posting). Useful for extending contract validation rules with customer-specific requirements, integration with other modules, or logging validation results.
OnAfterCopySalesContract(Record KVSKBASalesContractHeader, Record KVSKBASalesContractHeader, Boolean, Boolean) :#
Summary: Integration event raised after a sales contract has been copied.
[IntegrationEvent(false, false)]
local procedure OnAfterCopySalesContract(FromKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var ToKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; IncludeHeader: Boolean; DeletePricesAndDisc: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterCopySalesContract', '', false, false)]
local procedure DoSomethingOnAfterCopySalesContract(FromKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var ToKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; IncludeHeader: Boolean; DeletePricesAndDisc: Boolean)
begin
end;
Parameters:
FromKVSKBASalesContractHeader: The source contract header that was copied fromToKVSKBASalesContractHeader: The target contract header that was created/updatedIncludeHeader: Indicates whether the header fields were copiedDeletePricesAndDisc: Indicates whether prices and discounts were deleted
Remarks: This event is triggered after the CopySalesContract procedure completes copying a sales contract including header and/or lines. Subscribe to this event to perform post-copy processing, copy custom fields, adjust copied data, or create related records. The IncludeHeader parameter indicates whether header fields were copied (false for line-only copy). The DeletePricesAndDisc parameter indicates whether price and discount fields were cleared. Useful for extending copy functionality with custom logic, integration with other modules, or maintaining relationships with copied data.
OnAfterEnterItemReference(Record KVSKBASalesContractLine) :#
Summary: Integration event raised after an item reference has been entered on a contract line.
[IntegrationEvent(false, false)]
local procedure OnAfterEnterItemReference(var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterEnterItemReference', '', false, false)]
local procedure DoSomethingOnAfterEnterItemReference(var KVSKBASalesContractLine: Record "KVSKBASalesContractLine")
begin
end;
Parameters:
KVSKBASalesContractLine: The contract line where item reference was entered
Remarks: This event is triggered after the EnterItemReference procedure completes populating contract line fields from an item reference (cross-reference). Subscribe to this event to perform additional processing after item reference entry, update custom fields based on the reference, or trigger related validations. The contract line contains the updated item number, variant code, and unit of measure from the item reference. Useful for extending item reference functionality, integrating with custom catalog systems, or maintaining additional reference data.
OnAfterFinishContract(Record KVSKBASalesContractHeader) :#
Summary: Integration event raised after a contract has been finished.
[IntegrationEvent(false, false)]
local procedure OnAfterFinishContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterFinishContract', '', false, false)]
local procedure DoSomethingOnAfterFinishContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader")
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header that was finished
Remarks: This event is triggered after the FinishContract procedure completes marking a contract as finished. Subscribe to this event to perform post-finish processing, update related records, trigger workflows, or create archival data. At this point, the contract status is set to Finished, all lines are validated for complete shipping/receiving, and the finished by/date fields are populated. Useful for integrating contract completion with other systems, sending notifications, or maintaining completion history.
OnAfterGetTempValidContractLines(Record Sales Header, Record Sales Line, Record KVSKBATempTableWithNo, Boolean, Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised after valid contract lines have been retrieved for a sales line.
[IntegrationEvent(false, false)]
local procedure OnAfterGetTempValidContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBATempTableWithNo: Record "KVSKBATempTableWithNo" temporary; OnlyGetFirstContractLine: Boolean; var TempSalesContractLine: Record "KVSKBASalesContractLine" temporary; var Found: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterGetTempValidContractLines', '', false, false)]
local procedure DoSomethingOnAfterGetTempValidContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBATempTableWithNo: Record "KVSKBATempTableWithNo" temporary; OnlyGetFirstContractLine: Boolean; var TempSalesContractLine: Record "KVSKBASalesContractLine" temporary; var Found: Boolean)
begin
end;
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line to find contracts forKVSKBATempTableWithNo: Temporary table containing customer numbers in hierarchyOnlyGetFirstContractLine: Indicates whether only first match was requestedTempSalesContractLine: Temporary table containing the found contract linesFound: Indicates whether any contract lines were found
Remarks: This event is triggered after the GetTempValidContractLines procedure completes searching for applicable contract lines. Subscribe to this event to filter results, add additional contract lines from custom sources, or modify the found flag. The TempSalesContractLine temporary table contains all matching contracts considering customer hierarchy, item/variant, currency, and validity dates. Useful for extending contract search logic, integrating with external pricing systems, or applying custom filtering rules.
OnAfterLookupSalesContractLines(Record Sales Header, Record Sales Line, Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised after user lookup of contract lines has completed.
[IntegrationEvent(false, false)]
local procedure OnAfterLookupSalesContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var LineSelected: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterLookupSalesContractLines', '', false, false)]
local procedure DoSomethingOnAfterLookupSalesContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var LineSelected: Boolean)
begin
end;
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line the lookup was performed forKVSKBASalesContractLine: The contract line selected by the userLineSelected: Indicates whether a line was selected
Remarks: This event is triggered after the LookupSalesContractLines procedure completes and the user has closed the lookup page. Subscribe to this event to perform post-selection processing, validate the selected contract, update related fields, or trigger additional lookups. The LineSelected parameter indicates whether the user confirmed a selection (true) or cancelled (false). Useful for extending lookup behavior, cascading selections to related records, or applying business rules after contract selection.
OnAfterLookupItemReference(Record KVSKBASalesContractLine, Record Item Reference) :#
Summary: Integration event raised after item reference lookup has completed.
[IntegrationEvent(false, false)]
local procedure OnAfterLookupItemReference(KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var ReturnItemReference: Record "Item Reference"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterLookupItemReference', '', false, false)]
local procedure DoSomethingOnAfterLookupItemReference(KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var ReturnItemReference: Record "Item Reference")
begin
end;
Parameters:
KVSKBASalesContractLine: The contract line the lookup was performed forReturnItemReference: The item reference selected by the user
Remarks: This event is triggered after the LookupItemReference procedure completes and the user has selected an item reference. Subscribe to this event to perform post-lookup processing, validate the selected reference, or update additional fields based on the reference. The ReturnItemReference contains the selected cross-reference with item number, variant code, unit of measure, and reference details. Useful for extending item reference lookup behavior, integrating with custom catalog systems, or applying business rules after reference selection.
OnAfterSetDefaultSalesperson(Record KVSKBASalesContractHeader) :#
Summary: Integration event raised after default salesperson has been set on a contract header.
[IntegrationEvent(false, false)]
local procedure OnAfterSetDefaultSalesperson(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterSetDefaultSalesperson', '', false, false)]
local procedure DoSomethingOnAfterSetDefaultSalesperson(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader")
begin
end;
Parameters:
KVSKBASalesContractHeader: The contract header where salesperson was set
Remarks: This event is triggered after the SetDefaultSalesperson procedure populates the salesperson code from the customer. Subscribe to this event to perform additional processing after salesperson assignment, override the default logic, or update related fields. The contract header contains the updated salesperson code from the customer master. Useful for extending salesperson defaulting logic, assigning to sales teams, applying custom selection rules, or triggering notifications to assigned salespeople.
OnAfterReleaseContract(Record KVSKBASalesContractHeader) :#
Summary: Integration event raised after a contract has been released.
[IntegrationEvent(false, false)]
local procedure OnAfterReleaseContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterReleaseContract', '', false, false)]
local procedure DoSomethingOnAfterReleaseContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader")
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header that was released
Remarks: This event is triggered after the ReleaseContract procedure completes changing contract status to Released. Subscribe to this event to perform post-release processing, update related records, trigger workflows, or send notifications. At this point, all contract lines have been validated, status is set to Released, and the contract is ready for use in sales documents. Useful for integrating contract releases with approval workflows, sending notifications to stakeholders, updating external systems, or maintaining release audit trails.
OnAfterReopenContract(Record KVSKBASalesContractHeader) :#
Summary: Integration event raised after a contract has been reopened.
[IntegrationEvent(false, false)]
local procedure OnAfterReopenContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterReopenContract', '', false, false)]
local procedure DoSomethingOnAfterReopenContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader")
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header that was reopened
Remarks: This event is triggered after the ReopenContract procedure completes changing contract status back to Open. Subscribe to this event to perform post-reopen processing, update related records, or trigger workflows. At this point, the contract status is set to Open and all lines are updated to Open status, allowing modifications again. Useful for integrating contract reopening with workflows, sending notifications, updating external systems, or maintaining status change audit trails.
OnAfterVerifyContractLineChange(Record KVSKBASalesContractLine, Record KVSKBASalesContractLine, Integer) :#
Summary: Integration event raised after verifying changes to a contract line.
[IntegrationEvent(false, false)]
local procedure OnAfterVerifyContractLineChange(NewKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; OldKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; CalledFromFieldNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnAfterVerifyContractLineChange', '', false, false)]
local procedure DoSomethingOnAfterVerifyContractLineChange(NewKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; OldKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; CalledFromFieldNo: Integer)
begin
end;
Parameters:
NewKVSKBASalesContractLine: The new contract line data after changesOldKVSKBASalesContractLine: The original contract line data before changesCalledFromFieldNo: The field number that triggered the verification
Remarks: This event is triggered after the VerifyContractLineChange procedure completes checking whether changes to a released contract line are allowed. Subscribe to this event to perform post-verification processing, add custom change validations, or log changes. The procedure checks if the line is used in sales documents and prevents changes to key fields. CalledFromFieldNo indicates which field change triggered the verification. Useful for extending change control logic, maintaining change audit trails, or enforcing additional business rules.
OnBeforeCheckContractLineOnFinishing(Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised before checking a contract line during contract finishing.
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckContractLineOnFinishing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var Ishandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeCheckContractLineOnFinishing', '', false, false)]
local procedure DoSomethingOnBeforeCheckContractLineOnFinishing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var Ishandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header being finishedKVSKBASalesContractLine: The contract line to be checkedIshandled: Set to true to skip default checking logic
Remarks: This event is triggered before the CheckContractLineOnFinishing procedure validates a contract line. Subscribe to this event to replace or extend validation logic, perform pre-checks, or skip default validations. Set Ishandled to true to prevent standard checking. The default logic verifies line fields match header, no outstanding quantities exist on sales documents, and line data is complete. Useful for implementing custom finish validation rules, integrating with external systems before finishing, or applying conditional validation logic.
OnBeforeCheckContractLineOnReleasing(Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised before checking a contract line during contract releasing.
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckContractLineOnReleasing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeCheckContractLineOnReleasing', '', false, false)]
local procedure DoSomethingOnBeforeCheckContractLineOnReleasing(KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header being releasedKVSKBASalesContractLine: The contract line to be checkedIsHandled: Set to true to skip default checking logic
Remarks: This event is triggered before the CheckContractLineOnReleasing procedure validates a contract line. Subscribe to this event to replace or extend validation logic, perform pre-checks, or skip default validations. Set IsHandled to true to prevent standard checking. The default logic verifies required fields, checks blocking flags, validates variant codes, and ensures data consistency. Useful for implementing custom release validation rules, integrating with approval workflows, or applying conditional validation logic.
OnBeforeCheckSalesLineContractLine(Record Sales Header, Record Sales Line, Record KVSKBASalesContractHeader, Record KVSKBASalesContractLine, Boolean, Boolean) :#
Summary: Integration event raised before checking a sales line against its assigned contract.
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckSalesLineContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; SalesContractLine: Record "KVSKBASalesContractLine"; OnPosting: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeCheckSalesLineContractLine', '', false, false)]
local procedure DoSomethingOnBeforeCheckSalesLineContractLine(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; SalesContractLine: Record "KVSKBASalesContractLine"; OnPosting: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line being checkedKVSKBASalesContractHeader: The contract header assigned to the lineSalesContractLine: The contract line assigned to the sales lineOnPosting: Indicates whether check is executed during postingIsHandled: Set to true to skip default checking logic
Remarks: This event is triggered before the CheckSalesLineContractLine procedure validates contract compatibility. Subscribe to this event to replace or extend validation logic, perform pre-checks, or skip default validations. Set IsHandled to true to prevent standard checking. The default logic verifies contract status, customer hierarchy, currency, validity dates, item/variant/UoM matches, and location compatibility. OnPosting indicates validation context. Useful for implementing custom contract compatibility rules, integrating with external pricing systems, or applying conditional validation logic.
OnBeforeCopySalesContract(Record KVSKBASalesContractHeader, Record KVSKBASalesContractHeader, Boolean, Boolean, Boolean) :#
Summary: Integration event raised before copying a sales contract.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopySalesContract(FromKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var ToKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; IncludeHeader: Boolean; DeletePricesAndDisc: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeCopySalesContract', '', false, false)]
local procedure DoSomethingOnBeforeCopySalesContract(FromKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var ToKVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; IncludeHeader: Boolean; DeletePricesAndDisc: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
FromKVSKBASalesContractHeader: The source contract header to copy fromToKVSKBASalesContractHeader: The target contract header to copy toIncludeHeader: Indicates whether the header fields should be copiedDeletePricesAndDisc: Indicates whether prices and discounts should be deletedIsHandled: Set to true to skip default copying logic
Remarks: This event is triggered before the CopySalesContract procedure copies a contract. Subscribe to this event to replace or extend copy logic, perform pre-copy validations, or skip default copying. Set IsHandled to true to prevent standard copying. The default logic copies header fields (if IncludeHeader) and all lines, optionally clearing price and discount fields. Useful for implementing custom copy rules, integrating with external systems before copying, or applying conditional copy logic.
OnBeforeEnterItemReference(Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised before entering an item reference on a contract line.
[IntegrationEvent(false, false)]
local procedure OnBeforeEnterItemReference(var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeEnterItemReference', '', false, false)]
local procedure DoSomethingOnBeforeEnterItemReference(var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractLine: The contract line where item reference will be enteredIsHandled: Set to true to skip default item reference entry logic
Remarks: This event is triggered before the EnterItemReference procedure populates contract line fields from an item reference. Subscribe to this event to replace or extend item reference logic, perform pre-entry validations, or skip default entry. Set IsHandled to true to prevent standard processing. The default logic copies item number, variant code, and unit of measure from the reference. Useful for implementing custom item reference handling, integrating with external catalog systems, or applying conditional reference entry logic.
OnBeforeFinishContract(Record KVSKBASalesContractHeader, Boolean) :#
Summary: Integration event raised before finishing a contract.
[IntegrationEvent(false, false)]
local procedure OnBeforeFinishContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeFinishContract', '', false, false)]
local procedure DoSomethingOnBeforeFinishContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header to be finishedIsHandled: Set to true to skip default finishing logic
Remarks: This event is triggered before the FinishContract procedure marks a contract as finished. Subscribe to this event to replace or extend finish logic, perform pre-finish validations, or skip default finishing. Set IsHandled to true to prevent standard processing. The default logic validates Released status, checks all lines for completion, confirms with user, and updates status to Finished. Useful for implementing custom finish rules, integrating with approval workflows, or applying conditional finish logic.
OnBeforeGetTempValidContractLines(Record Sales Header, Record Sales Line, Record KVSKBATempTableWithNo, Boolean, Record KVSKBASalesContractLine, Boolean, Boolean) :#
Summary: Integration event raised before retrieving valid contract lines for a sales line.
[IntegrationEvent(false, false)]
local procedure OnBeforeGetTempValidContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBATempTableWithNo: Record "KVSKBATempTableWithNo" temporary; OnlyGetFirstContractLine: Boolean; var TempSalesContractLine: Record "KVSKBASalesContractLine" temporary; var Found: Boolean; var Ishandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeGetTempValidContractLines', '', false, false)]
local procedure DoSomethingOnBeforeGetTempValidContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBATempTableWithNo: Record "KVSKBATempTableWithNo" temporary; OnlyGetFirstContractLine: Boolean; var TempSalesContractLine: Record "KVSKBASalesContractLine" temporary; var Found: Boolean; var Ishandled: Boolean)
begin
end;
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line to find contracts forKVSKBATempTableWithNo: Temporary table containing customer numbers in hierarchyOnlyGetFirstContractLine: Indicates whether only first match is requestedTempSalesContractLine: Temporary table to populate with found contract linesFound: Set to true if contract lines are foundIshandled: Set to true to skip default search logic
Remarks: This event is triggered before the GetTempValidContractLines procedure searches for applicable contracts. Subscribe to this event to replace or extend search logic, pre-populate results, or skip default searching. Set Ishandled to true to prevent standard processing. The default logic searches Released contracts matching item/resource, variant, currency, and validity dates across customer hierarchy. Useful for implementing custom contract search rules, integrating with external pricing systems, or applying conditional search logic.
OnBeforeLookupItemReference(Record KVSKBASalesContractLine, Record Item Reference, Boolean) :#
Summary: Integration event raised before looking up an item reference for a contract line.
[IntegrationEvent(false, false)]
local procedure OnBeforeLookupItemReference(KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var ReturnItemReference: Record "Item Reference"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeLookupItemReference', '', false, false)]
local procedure DoSomethingOnBeforeLookupItemReference(KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var ReturnItemReference: Record "Item Reference"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractLine: The contract line to lookup item reference forReturnItemReference: The item reference record to populate with lookup resultIsHandled: Set to true to skip default lookup logic
Remarks: This event is triggered before the LookupItemReference procedure opens the item reference lookup page. Subscribe to this event to replace or extend lookup logic, pre-select references, or skip default lookup. Set IsHandled to true to prevent standard processing. The default logic filters item references by customer, item, variant, and unit of measure, then opens a lookup page. Useful for implementing custom item reference lookups, integrating with external catalog systems, or applying conditional lookup filters.
OnBeforeLookupSalesContractLines(Record Sales Header, Record Sales Line, Record KVSKBASalesContractLine, Boolean, Boolean) :#
Summary: Integration event raised before looking up contract lines for a sales line.
[IntegrationEvent(false, false)]
local procedure OnBeforeLookupSalesContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var LineSelected: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeLookupSalesContractLines', '', false, false)]
local procedure DoSomethingOnBeforeLookupSalesContractLines(SalesHeader: Record "Sales Header"; SalesLine: Record "Sales Line"; var KVSKBASalesContractLine: Record "KVSKBASalesContractLine"; var LineSelected: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
SalesHeader: The sales header providing document contextSalesLine: The sales line to find contracts forKVSKBASalesContractLine: The contract line record to populate with lookup resultLineSelected: Set to true if a line was selectedIsHandled: Set to true to skip default lookup logic
Remarks: This event is triggered before the LookupSalesContractLines procedure searches for and displays applicable contracts. Subscribe to this event to replace or extend lookup logic, pre-select contracts, or skip default lookup. Set IsHandled to true to prevent standard processing. The default logic validates line type, searches customer hierarchy for valid contracts, and opens a lookup page. Useful for implementing custom contract lookups, filtering available contracts, or applying conditional lookup logic.
OnBeforeReleaseContract(Record KVSKBASalesContractHeader, Boolean) :#
Summary: Integration event raised before releasing a contract.
[IntegrationEvent(false, false)]
local procedure OnBeforeReleaseContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeReleaseContract', '', false, false)]
local procedure DoSomethingOnBeforeReleaseContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header to be releasedIsHandled: Set to true to skip default release logic
Remarks: This event is triggered before the ReleaseContract procedure changes contract status to Released. Subscribe to this event to replace or extend release logic, perform pre-release validations, or skip default releasing. Set IsHandled to true to prevent standard processing. The default logic validates all contract lines, checks required fields, and updates status to Released. Useful for implementing custom release rules, integrating with approval workflows, or applying conditional release logic.
OnBeforeReopenContract(Record KVSKBASalesContractHeader, Boolean) :#
Summary: Integration event raised before reopening a contract.
[IntegrationEvent(false, false)]
local procedure OnBeforeReopenContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeReopenContract', '', false, false)]
local procedure DoSomethingOnBeforeReopenContract(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header to be reopenedIsHandled: Set to true to skip default reopen logic
Remarks: This event is triggered before the ReopenContract procedure changes contract status back to Open. Subscribe to this event to replace or extend reopen logic, perform pre-reopen validations, or skip default reopening. Set IsHandled to true to prevent standard processing. The default logic validates Released status and updates contract and all lines to Open status. Useful for implementing custom reopen rules, checking for usage in sales documents, or applying conditional reopen logic.
OnBeforeSetDefaultSalesperson(Record KVSKBASalesContractHeader, Boolean) :#
Summary: Integration event raised before setting default salesperson on a contract header.
[IntegrationEvent(false, false)]
local procedure OnBeforeSetDefaultSalesperson(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeSetDefaultSalesperson', '', false, false)]
local procedure DoSomethingOnBeforeSetDefaultSalesperson(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"; var IsHandled: Boolean)
begin
end;
Parameters:
KVSKBASalesContractHeader: The contract header where salesperson will be setIsHandled: Set to true to skip default salesperson logic
Remarks: This event is triggered before the SetDefaultSalesperson procedure populates the salesperson code from the customer. Subscribe to this event to replace or extend salesperson defaulting logic, pre-assign custom salespeople, or skip default assignment. Set IsHandled to true to prevent standard processing. The default logic copies the salesperson code from the customer master. Useful for implementing custom salesperson selection rules, integrating with sales team management, or applying conditional assignment logic.
OnBeforeVerifyContractLineChange(Record KVSKBASalesContractLine, Record KVSKBASalesContractLine, Integer, Boolean) :#
Summary: Integration event raised before verifying changes to a contract line.
[IntegrationEvent(false, false)]
local procedure OnBeforeVerifyContractLineChange(NewKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; OldVSKBASalesContractLine: Record "KVSKBASalesContractLine"; CalledFromFieldNo: Integer; var Ishandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeVerifyContractLineChange', '', false, false)]
local procedure DoSomethingOnBeforeVerifyContractLineChange(NewKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; OldVSKBASalesContractLine: Record "KVSKBASalesContractLine"; CalledFromFieldNo: Integer; var Ishandled: Boolean)
begin
end;
Parameters:
NewKVSKBASalesContractLine: The new contract line data after changesOldVSKBASalesContractLine: The original contract line data before changesCalledFromFieldNo: The field number that triggered the verificationIshandled: Set to true to skip default verification logic
Remarks: This event is triggered before the VerifyContractLineChange procedure checks whether changes to a released contract line are allowed. Subscribe to this event to replace or extend verification logic, allow/prevent specific changes, or skip default verification. Set Ishandled to true to prevent standard processing. The default logic checks if the line is used in sales documents and prevents changes to key fields. CalledFromFieldNo indicates which field change triggered the verification. Useful for implementing custom change control rules, applying conditional change permissions, or extending field change validation.
OnCopySalesContractOnBeforeModifyToSalesContractLine(Record KVSKBASalesContractLine, Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised during contract copying before modifying a target contract line.
[IntegrationEvent(false, false)]
local procedure OnCopySalesContractOnBeforeModifyToSalesContractLine(FromKVSKBASalesContractLin: Record "KVSKBASalesContractLine"; var ToKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; DeletePricesAndDisc: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnCopySalesContractOnBeforeModifyToSalesContractLine', '', false, false)]
local procedure DoSomethingOnCopySalesContractOnBeforeModifyToSalesContractLine(FromKVSKBASalesContractLin: Record "KVSKBASalesContractLine"; var ToKVSKBASalesContractLine: Record "KVSKBASalesContractLine"; DeletePricesAndDisc: Boolean)
begin
end;
Parameters:
FromKVSKBASalesContractLin: The source contract line being copied fromToKVSKBASalesContractLine: The target contract line about to be modifiedDeletePricesAndDisc: Indicates whether prices and discounts are being deleted
Remarks: This event is triggered within the CopySalesContract procedure just before a target contract line is modified with copied data. Subscribe to this event to adjust the line data before modification, copy additional custom fields, or skip copying certain fields. The ToKVSKBASalesContractLine has been populated with source data but not yet modified in the database. DeletePricesAndDisc indicates whether price and discount fields have been cleared. Useful for extending contract line copy functionality, maintaining custom field relationships, or applying transformation logic during copying.
OnReleaseContractOnBeforeChangeSalesContractStatus(Record KVSKBASalesContractHeader) :#
Summary: Integration event raised during contract release just before changing the contract status.
[IntegrationEvent(false, false)]
local procedure OnReleaseContractOnBeforeChangeSalesContractStatus(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnReleaseContractOnBeforeChangeSalesContractStatus', '', false, false)]
local procedure DoSomethingOnReleaseContractOnBeforeChangeSalesContractStatus(var KVSKBASalesContractHeader: Record "KVSKBASalesContractHeader")
begin
end;
Parameters:
KVSKBASalesContractHeader: The sales contract header about to have status changed
Remarks: This event is triggered within the ReleaseContract procedure after all line validations are complete but before the status is actually changed to Released. Subscribe to this event to perform final validations, update additional fields, or prepare related records before the status change. All contract lines have been validated at this point. Useful for implementing last-minute checks, updating custom status fields, integrating with external systems, or maintaining detailed audit trails of status changes.
OnBeforeCheckVariantCodeatContractLineOnReleasing(Record KVSKBASalesContractLine, Boolean) :#
Summary: Integration event raised before checking variant code during contract line release validation.
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckVariantCodeatContractLineOnReleasing(SalesContractLine: Record "KVSKBASalesContractLine"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASalesContractManagement", 'OnBeforeCheckVariantCodeatContractLineOnReleasing', '', false, false)]
local procedure DoSomethingOnBeforeCheckVariantCodeatContractLineOnReleasing(SalesContractLine: Record "KVSKBASalesContractLine"; var IsHandled: Boolean)
begin
end;
Parameters:
SalesContractLine: The contract line to check variant code forIsHandled: Set to true to skip default variant code checking
Remarks: This event is triggered within the CheckContractLineOnReleasing procedure before validating variant code existence. Subscribe to this event to replace or extend variant code validation logic, or skip default validation. Set IsHandled to true to prevent standard processing. The default logic checks that variant codes exist in the Item Variant table. Useful for implementing custom variant validation rules, integrating with external product catalogs, or applying conditional variant checking based on item attributes.