KVSKBASrvCopyDocumentLib#
Procedures#
CopyServiceDocument(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header) :#
Summary: Copies a service document from a source to a target service header.
procedure CopyServiceDocument(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"):
Parameters:
ServiceDocumentTypeFrom: Source document type to copy from (Quote, Order, Invoice, Credit Memo, Posted documents, Archived documents).FromDocumentNo: Source document number to copy from.ToServiceHeader: Target Service Header to which the document will be copied.
Remarks: This procedure performs a comprehensive copy operation of service documents, including lines, items, texts, and price calculations. The behavior is controlled by global settings set via SetProperties.
Key functionality:
- Validates source and target documents
- Optionally copies header fields (if GlobalIncludeHeader = TRUE)
- Copies service item lines and service lines
- Handles both unposted and posted source documents
- Supports copying from archived documents
- Preserves or recalculates prices based on GlobalRecalculateLines
- Copies or updates document texts based on GlobalUpdateTexts
- Updates document process ID
- Optionally recalculates graduated pricing if immediate price update is enabled
Process flow:
1. Initializes and validates source/target documents
2. Locks service lines to prevent concurrent modifications
3. Optionally deletes existing lines if including header
4. Copies header fields if GlobalIncludeHeader = TRUE
5. Creates service item lines and service lines from source
6. Evaluates and recalculates line totals
7. Updates graduated pricing if configured
Integration events:
- OnBeforeCopyServiceDocument: Allows bypassing standard copy logic
- OnAfterCopyServiceDocument: Allows post-processing after copy
This is typically called from "Copy Document" actions in service order/quote pages.
SetProperties(Integer, Integer, Boolean, Boolean, Boolean) :#
Summary: Configures the copy operation parameters for copying service documents.
procedure SetProperties(NewDocumentNoOccurrence: Integer; NewVersionNo: Integer; NewIncludeHeader: Boolean; NewRecalculateLines: Boolean; CopyDocumentProccessID: Boolean):
Parameters:
NewDocumentNoOccurrence: Document number occurrence (for archived documents).NewVersionNo: Version number (for archived documents).NewIncludeHeader: If TRUE, copies header fields; if FALSE, keeps existing header.NewRecalculateLines: If TRUE, recalculates prices and quantities; if FALSE, copies values as-is.CopyDocumentProccessID: If TRUE, copies document process ID; if FALSE, generates new ID.
Remarks: This procedure must be called before CopyServiceDocument to configure copy behavior.
Parameters explained:
- NewDocumentNoOccurrence & NewVersionNo: Required when copying from archived documents to identify
the specific archive version. Ignored for non-archived documents.
- NewIncludeHeader: Controls whether header fields are copied from source to target.
* TRUE: Replaces target header fields (customer, dates, addresses, etc.) with source values
* FALSE: Keeps target header as-is, only copies lines
- NewRecalculateLines: Controls price and quantity handling.
* TRUE: Recalculates unit prices, discounts, and validates quantities against current master data
* FALSE: Copies prices and quantities exactly as they were in source document
- CopyDocumentProccessID: Controls document process ID handling.
* TRUE: Maintains same process ID (links documents as related)
* FALSE: Generates new process ID (creates independent document)
Additional behavior:
- Sets GlobalUpdateTexts to FALSE (texts copied from source)
- Resets GlobalSkipTestCreditLimit to FALSE
Common usage patterns:
- Copy with recalculation: NewIncludeHeader=TRUE, NewRecalculateLines=TRUE (fresh prices)
- Exact copy: NewIncludeHeader=TRUE, NewRecalculateLines=FALSE (historical prices)
- Copy lines only: NewIncludeHeader=FALSE, NewRecalculateLines varies
SetProperties(Integer, Integer, Boolean, Boolean, Boolean, Boolean) :#
Summary: Configures the copy operation parameters including text update behavior.
procedure SetProperties(NewDocumentNoOccurrence: Integer; NewVersionNo: Integer; NewIncludeHeader: Boolean; NewRecalculateLines: Boolean; CopyDocumentProccessID: Boolean; NewUpdateTexts: Boolean):
Parameters:
NewDocumentNoOccurrence: Document number occurrence (for archived documents).NewVersionNo: Version number (for archived documents).NewIncludeHeader: If TRUE, copies header fields; if FALSE, keeps existing header.NewRecalculateLines: If TRUE, recalculates prices and quantities; if FALSE, copies values as-is.CopyDocumentProccessID: If TRUE, copies document process ID; if FALSE, generates new ID.NewUpdateTexts: If TRUE, regenerates texts from master data; if FALSE, copies texts from source.
Remarks: This overload extends the basic SetProperties with control over text handling. It provides all the functionality of the simpler overload plus text update control.
Additional parameter:
- NewUpdateTexts: Controls how KUMAVISION document texts are handled.
* TRUE: Regenerates texts from current master data (items, customers, etc.)
- Useful when master data descriptions have been updated
- Ensures texts match current item/customer setup
- Triggers Validate("No.") on lines to refresh texts
* FALSE: Copies texts exactly as they were in source document
- Preserves historical text content
- Maintains custom text modifications
- Copies KUMAVISION document text records
All other parameters behave identically to the simpler SetProperties overload.
Usage scenarios:
- NewUpdateTexts=TRUE: When master data has changed and texts should reflect current values
- NewUpdateTexts=FALSE: When preserving exact historical document content including texts
Example: Copying a quote to order with updated texts:
SetProperties(0, 0, TRUE, TRUE, FALSE, TRUE)
- Include header, recalculate prices, new process ID, update texts
Example: Exact historical copy:
SetProperties(0, 0, TRUE, FALSE, TRUE, FALSE)
- Include header, keep prices, same process ID, keep original texts
Events#
OnBeforeCopyFieldsServiceHeaderPostedCreditMemo(Record Service Header, Boolean, Boolean) :#
Summary: Integration event raised before copying header fields from a posted service credit memo.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyFieldsServiceHeaderPostedCreditMemo(ServiceHeader: Record "Service Header"; var CopyHeader: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyFieldsServiceHeaderPostedCreditMemo', '', false, false)]
local procedure DoSomethingOnBeforeCopyFieldsServiceHeaderPostedCreditMemo(ServiceHeader: Record "Service Header"; var CopyHeader: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header being copied to.CopyHeader: If TRUE, header fields will be copied; if FALSE, header is preserved.IsHandled: Set to TRUE to bypass standard header copy logic.
Remarks: This event allows subscribers to: - Override the standard header copy behavior from posted credit memos - Conditionally prevent header copying based on custom business rules - Apply custom field mappings when copying from posted credit memos
When IsHandled is set to TRUE, the standard copy logic is completely bypassed, and subscribers
are responsible for implementing any required field copying.
Use cases:
- Implementing custom credit memo header copying rules
- Preventing certain fields from being copied in specific scenarios
- Adding validation or logging when copying from posted documents
Related to CopyFieldsFromPostedServiceCrMemoHeader procedure.
OnBeforeCopyFieldsServiceHeaderPostedInvoice(Record Service Header, Boolean, Boolean) :#
Summary: Integration event raised before copying header fields from a posted service invoice.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyFieldsServiceHeaderPostedInvoice(ServiceHeader: Record "Service Header"; var CopyHeader: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyFieldsServiceHeaderPostedInvoice', '', false, false)]
local procedure DoSomethingOnBeforeCopyFieldsServiceHeaderPostedInvoice(ServiceHeader: Record "Service Header"; var CopyHeader: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header being copied to.CopyHeader: If TRUE, header fields will be copied; if FALSE, header is preserved.IsHandled: Set to TRUE to bypass standard header copy logic.
Remarks: This event allows subscribers to: - Override the standard header copy behavior from posted invoices - Conditionally prevent header copying based on custom business rules - Apply custom field mappings when copying from posted invoices
When IsHandled is set to TRUE, the standard copy logic is completely bypassed, and subscribers
are responsible for implementing any required field copying.
Use cases:
- Implementing custom invoice header copying rules
- Preventing certain fields from being copied in specific scenarios
- Adding validation or logging when copying from posted documents
- Handling KUMAVISION-specific fields during copy operations
Related to CopyFieldsFromPostedServiceInvoiceHeader procedure.
OnGetGetServiceDocumentTypeCaseElse(Enum KVSKBAServiceDocumentTypeFrom, Enum Service Document Type) :#
[IntegrationEvent(false, false)]
local procedure OnGetGetServiceDocumentTypeCaseElse(FromServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; var ToServiceDocumentType: Enum "Service Document Type"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnGetGetServiceDocumentTypeCaseElse', '', false, false)]
local procedure DoSomethingOnGetGetServiceDocumentTypeCaseElse(FromServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; var ToServiceDocumentType: Enum "Service Document Type")
begin
end;
OnBeforeCopyAddedTablesFromPostedDocs(Record Service Line, Enum KVSKBAPostedServiceDocType, Code[20], Integer, Boolean) :#
Summary: Integration event raised before copying KUMAVISION extension data from posted service documents.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyAddedTablesFromPostedDocs(var ServiceLine: Record "Service Line"; PostedServiceDocType: Enum "KVSKBAPostedServiceDocType"; DocumentNo: Code[20]; DocumentLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyAddedTablesFromPostedDocs', '', false, false)]
local procedure DoSomethingOnBeforeCopyAddedTablesFromPostedDocs(var ServiceLine: Record "Service Line"; PostedServiceDocType: Enum "KVSKBAPostedServiceDocType"; DocumentNo: Code[20]; DocumentLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceLine: The target Service Line to which data will be copied.PostedServiceDocType: The type of posted document (Shipment, Invoice, Credit Memo).DocumentNo: The posted document number.DocumentLineNo: The posted document line number.IsHandled: Set to TRUE to bypass standard copy logic for added tables.
Remarks: This event allows subscribers to: - Override standard copying of KUMAVISION extension data from posted documents - Implement custom data copying logic for extension tables - Conditionally prevent copying based on document type or custom rules
KUMAVISION extension data includes:
- Document texts (ServiceDocumentText table)
- Price calculation lines (ServicePriceCalcLine table)
- Discount calculation lines (ServiceDiscCalcLine table)
- Custom line-level attributes
When IsHandled is set to TRUE, subscribers must implement the complete copy logic
for all required extension tables.
Use cases:
- Customizing what extension data is copied from posted documents
- Implementing tenant-specific copy rules
- Filtering or transforming extension data during copy
- Adding logging or audit trails for copied data
Related to CopyAddedTablesFromPostedDocs local procedure.
OnAfterCopyAddedTablesFromPostedDocs(Record Service Line, Enum KVSKBAPostedServiceDocType, Code[20], Integer) :#
Summary: Integration event raised after copying KUMAVISION extension data from posted service documents.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyAddedTablesFromPostedDocs(var ServiceLine: Record "Service Line"; PostedServiceDocType: Enum "KVSKBAPostedServiceDocType"; DocumentNo: Code[20]; DocumentLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyAddedTablesFromPostedDocs', '', false, false)]
local procedure DoSomethingOnAfterCopyAddedTablesFromPostedDocs(var ServiceLine: Record "Service Line"; PostedServiceDocType: Enum "KVSKBAPostedServiceDocType"; DocumentNo: Code[20]; DocumentLineNo: Integer)
begin
end;
Parameters:
ServiceLine: The target Service Line to which data was copied.PostedServiceDocType: The type of posted document (Shipment, Invoice, Credit Memo).DocumentNo: The posted document number.DocumentLineNo: The posted document line number.
Remarks: This event allows subscribers to: - Post-process KUMAVISION extension data after it has been copied - Add additional extension tables not handled by standard logic - Validate or transform copied data - Synchronize related records in custom tables
At this point, standard KUMAVISION extension data has been copied, including:
- Document texts from posted documents
- Price calculation lines
- Discount calculation lines
Use cases:
- Copying additional custom extension tables
- Recalculating fields based on copied data
- Triggering workflows or notifications
- Creating audit log entries
- Updating statistics or reporting tables
Example: After copying from a posted invoice, subscribers might copy additional
custom warranty or service agreement data not handled by standard logic.
Related to CopyAddedTablesFromPostedDocs local procedure.
OnBeforeCopyServiceLinefromServiceLine(Record Service Line, Record Service Header, Record Service Line, Integer, Boolean) :#
Summary: Integration event raised before copying a service line from one service document to another.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceLinefromServiceLine(var ToServiceLine: Record "Service Line"; ToServiceHeader: Record "Service Header"; FromServiceLine: Record "Service Line"; ServiceItemLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceLinefromServiceLine', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceLinefromServiceLine(var ToServiceLine: Record "Service Line"; ToServiceHeader: Record "Service Header"; FromServiceLine: Record "Service Line"; ServiceItemLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ToServiceLine: The target Service Line being created.ToServiceHeader: The target Service Header.FromServiceLine: The source Service Line being copied from.ServiceItemLineNo: The service item line number to assign to the new line.IsHandled: Set to TRUE to bypass standard line copy logic.
Remarks: This event allows subscribers to: - Override standard service line copying between unposted documents - Implement custom line copy logic - Conditionally prevent line copying based on business rules - Apply custom field mappings or transformations
When IsHandled is set to TRUE, subscribers must:
- Initialize and populate ToServiceLine completely
- Handle service item line number assignment
- Copy KUMAVISION extension data if needed
- Perform any required validation
Use cases:
- Customizing which fields are copied between documents
- Implementing tenant-specific copy rules
- Filtering lines based on custom criteria
- Applying business logic during document conversion (e.g., Quote → Order)
- Modifying quantities or prices during copy
This event fires when copying from unposted service documents (Quote, Order, Invoice, Credit Memo).
For copying from posted documents, see OnBeforeCopyServiceLineFromServiceShipmentLine,
OnBeforeCopyServiceLineFromServiceInvoiceLine, and OnBeforeCopyServiceLineFromServiceCrMemoLine.
Related to CopyServiceLineFromServiceLine local procedure.
OnAfterCopyServiceLinefromServiceLine(Record Service Line, Record Service Header, Record Service Line, Integer) :#
Summary: Integration event raised after copying a service line from one service document to another.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceLinefromServiceLine(var ToServiceLine: Record "Service Line"; ToServiceHeader: Record "Service Header"; FromServiceLine: Record "Service Line"; ServiceItemLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceLinefromServiceLine', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceLinefromServiceLine(var ToServiceLine: Record "Service Line"; ToServiceHeader: Record "Service Header"; FromServiceLine: Record "Service Line"; ServiceItemLineNo: Integer)
begin
end;
Parameters:
ToServiceLine: The newly created target Service Line.ToServiceHeader: The target Service Header.FromServiceLine: The source Service Line that was copied from.ServiceItemLineNo: The service item line number assigned to the new line.
Remarks: This event allows subscribers to: - Post-process copied service lines - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard line copy has completed, including:
- All standard fields transferred via TransferFields
- Service item line number assigned
- Line validated and checked
- KUMAVISION extension data copied (texts, price calc lines, etc.)
Use cases:
- Copying additional custom extension tables
- Recalculating dependent fields
- Creating audit log entries
- Triggering workflows or notifications
- Updating custom statistics or reporting tables
- Synchronizing data with external systems
Example: After copying a service line, subscribers might copy additional custom
warranty tracking or service agreement allocation data.
Related to CopyServiceLineFromServiceLine local procedure.
OnBeforeCopyServiceDocument(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Boolean) :#
Summary: Integration event raised at the beginning of the service document copy process.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceDocument(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNoentNo: Code[20]; var ToServiceHeader: Record "Service Header"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceDocument', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceDocument(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNoentNo: Code[20]; var ToServiceHeader: Record "Service Header"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source document type to copy from.FromDocumentNoentNo: The source document number to copy from.ToServiceHeader: The target Service Header to which the document will be copied.IsHandled: Set to TRUE to bypass the entire standard copy process.
Remarks: This is the master integration event for the entire document copy operation. It allows subscribers to: - Completely replace the standard copy logic with custom implementation - Perform pre-copy validation and business logic - Log or audit copy operations before they occur - Conditionally prevent copy operations based on business rules
When IsHandled is set to TRUE, the entire CopyServiceDocument procedure is bypassed, and subscribers
are responsible for:
- Copying header fields (if required)
- Creating service item lines
- Creating service lines
- Copying texts and extension data
- Recalculating prices and totals
- Handling document process ID
This is the earliest intervention point in the copy process, occurring before any validation,
locking, or data retrieval.
Use cases:
- Implementing completely custom copy workflows
- Adding approval requirements before copying
- Implementing tenant-specific copy restrictions
- Redirecting to alternative copy procedures based on document properties
Related to CopyServiceDocument internal procedure.
OnAfterInitAndCheckServiceDocuments(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Record Service Header, Record Service Shipment Header, Record Service Invoice Header, Record Service Cr.Memo Header, Boolean, Boolean, Boolean) :#
Summary: Integration event raised after initializing and validating source and target documents.
[IntegrationEvent(false, false)]
local procedure OnAfterInitAndCheckServiceDocuments(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocNo: Code[20]; var ToServiceHeader: Record "Service Header"; var FromServiceHeader: Record "Service Header"; var FromServiceShipmentHeader: Record "Service Shipment Header"; var FromServiceInvoiceHeader: Record "Service Invoice Header"; var FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; IncludeHeader: Boolean; RecalculateLines: Boolean; var Result: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterInitAndCheckServiceDocuments', '', false, false)]
local procedure DoSomethingOnAfterInitAndCheckServiceDocuments(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocNo: Code[20]; var ToServiceHeader: Record "Service Header"; var FromServiceHeader: Record "Service Header"; var FromServiceShipmentHeader: Record "Service Shipment Header"; var FromServiceInvoiceHeader: Record "Service Invoice Header"; var FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; IncludeHeader: Boolean; RecalculateLines: Boolean; var Result: Boolean)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source document type.FromDocNo: The source document number.ToServiceHeader: The target Service Header.FromServiceHeader: The source Service Header (if copying from unposted document).FromServiceShipmentHeader: The source Service Shipment Header (if copying from posted shipment).FromServiceInvoiceHeader: The source Service Invoice Header (if copying from posted invoice).FromServiceCrMemoHeader: The source Service Credit Memo Header (if copying from posted credit memo).IncludeHeader: Indicates whether header fields will be copied.RecalculateLines: Indicates whether lines will be recalculated.Result: Can be set to FALSE to abort the copy operation.
Remarks: This event is raised after the copy procedure has: - Retrieved the source document (whichever type it is) - Validated that the source document exists - Prepared the target document - Determined copy settings (header, recalculate)
Subscribers can:
- Perform additional validation on source/target compatibility
- Check business rules before proceeding with copy
- Modify copy behavior flags (IncludeHeader, RecalculateLines)
- Abort the copy by setting Result to FALSE
- Log or audit the copy operation with complete context
Only one of the From...Header parameters will contain data, depending on ServiceDocumentTypeFrom:
- Unposted docs: FromServiceHeader is populated
- Posted Shipment: FromServiceShipmentHeader is populated
- Posted Invoice: FromServiceInvoiceHeader is populated
- Posted Credit Memo: FromServiceCrMemoHeader is populated
Use cases:
- Enforcing cross-document validation rules
- Checking customer credit limits before copying
- Verifying item availability
- Implementing approval workflows
- Conditional copy behavior based on document properties
Related to InitAndCheckServiceDocuments local procedure.
OnAfterCopyServiceDocumentUpdateHeader(Record Service Header, Record Service Header, Record Service Shipment Header, Record Service Invoice Header, Record Service Cr.Memo Header, Record Service Header Archive, Enum KVSKBAServiceDocumentTypeFrom, Code[20]) :#
Summary: Integration event raised after updating the target service header with fields from the source.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceDocumentUpdateHeader(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"; FromServiceShipmentHeader: Record "Service Shipment Header"; FromServiceInvoiceHeader: Record "Service Invoice Header"; FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; FromServiceHeaderArchive: Record "Service Header Archive"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; SavedDocumentProcessID: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceDocumentUpdateHeader', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceDocumentUpdateHeader(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"; FromServiceShipmentHeader: Record "Service Shipment Header"; FromServiceInvoiceHeader: Record "Service Invoice Header"; FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; FromServiceHeaderArchive: Record "Service Header Archive"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; SavedDocumentProcessID: Code[20])
begin
end;
Parameters:
ToServiceHeader: The target Service Header that was updated.FromServiceHeader: The source Service Header (if copying from unposted document).FromServiceShipmentHeader: The source Service Shipment Header (if copying from posted shipment).FromServiceInvoiceHeader: The source Service Invoice Header (if copying from posted invoice).FromServiceCrMemoHeader: The source Service Credit Memo Header (if copying from posted credit memo).FromServiceHeaderArchive: The source Service Header Archive (if copying from archived document).ServiceDocumentTypeFrom: The source document type.SavedDocumentProcessID: The original document process ID before copy (if preserved).
Remarks: This event is raised after the standard header update logic has executed, allowing subscribers to: - Copy additional custom header fields not handled by standard logic - Post-process copied header fields - Perform validation or business logic after header update - Synchronize related records or statistics
At this point, standard header fields have been copied based on the source document type:
- Customer information, addresses, contact details
- Dates (order date, posting date, etc.)
- Currency and payment terms
- Dimensions and posting groups
- KUMAVISION-specific fields (assigned user, contract, etc.)
Only one of the From...Header parameters will contain data, depending on ServiceDocumentTypeFrom.
SavedDocumentProcessID contains the original process ID if GlobalCopyDocumentProcessID was TRUE,
allowing subscribers to implement custom process ID logic.
Use cases:
- Copying additional custom header fields from extensions
- Recalculating derived fields after copy
- Implementing custom document process ID logic
- Triggering workflows or notifications
- Creating audit log entries with source/target context
- Updating custom statistics or reporting tables
Related to CopyServiceDocumentUpdateHeader local procedure.
OnBeforeCopyServiceDocumentUpdateHeader(Record Service Header, Record Service Header, Record Service Shipment Header, Record Service Invoice Header, Record Service Cr.Memo Header, Record Service Header Archive, Enum KVSKBAServiceDocumentTypeFrom, Code[20], Boolean) :#
Summary: Integration event raised before updating the target service header with fields from the source.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceDocumentUpdateHeader(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"; FromServiceShipmentHeader: Record "Service Shipment Header"; FromServiceInvoiceHeader: Record "Service Invoice Header"; FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; FromServiceHeaderArchive: Record "Service Header Archive"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; SavedDocumentProcessID: Code[20]; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceDocumentUpdateHeader', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceDocumentUpdateHeader(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"; FromServiceShipmentHeader: Record "Service Shipment Header"; FromServiceInvoiceHeader: Record "Service Invoice Header"; FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; FromServiceHeaderArchive: Record "Service Header Archive"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; SavedDocumentProcessID: Code[20]; var IsHandled: Boolean)
begin
end;
Parameters:
ToServiceHeader: The target Service Header to be updated.FromServiceHeader: The source Service Header (if copying from unposted document).FromServiceShipmentHeader: The source Service Shipment Header (if copying from posted shipment).FromServiceInvoiceHeader: The source Service Invoice Header (if copying from posted invoice).FromServiceCrMemoHeader: The source Service Credit Memo Header (if copying from posted credit memo).FromServiceHeaderArchive: The source Service Header Archive (if copying from archived document).ServiceDocumentTypeFrom: The source document type.SavedDocumentProcessID: The original document process ID (if being preserved).IsHandled: Set to TRUE to bypass standard header update logic.
Remarks: This event allows subscribers to: - Override the standard header update logic completely - Implement custom header field mapping - Conditionally prevent header updates based on business rules - Apply custom transformations to header fields during copy
When IsHandled is set to TRUE, subscribers must handle:
- Transferring all required header fields from source to target
- Handling different source types (unposted, posted, archived)
- Managing document process ID if applicable
- Preserving or resetting key fields like number series
Only one of the From...Header parameters will contain data, depending on ServiceDocumentTypeFrom:
- Quote, Order, Invoice, Credit Memo: FromServiceHeader
- Posted Shipment: FromServiceShipmentHeader
- Posted Invoice: FromServiceInvoiceHeader
- Posted Credit Memo: FromServiceCrMemoHeader
- Arch. Quote, Arch. Order: FromServiceHeaderArchive
Use cases:
- Implementing completely custom header copy logic
- Selectively copying fields based on document type
- Applying business rules during header transfer
- Implementing tenant-specific field mappings
- Adding validation before header update
Related to CopyServiceDocumentUpdateHeader local procedure.
OnCopyServiceDocumentUpdateHeaderCaseElseServiceDocumentTypeFrom(Record Service Header, Enum KVSKBAServiceDocumentTypeFrom) :#
Summary: Integration event raised when updating header from a document type not handled by standard logic.
[IntegrationEvent(false, false)]
local procedure OnCopyServiceDocumentUpdateHeaderCaseElseServiceDocumentTypeFrom(var ToServiceHeader: Record "Service Header"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnCopyServiceDocumentUpdateHeaderCaseElseServiceDocumentTypeFrom', '', false, false)]
local procedure DoSomethingOnCopyServiceDocumentUpdateHeaderCaseElseServiceDocumentTypeFrom(var ToServiceHeader: Record "Service Header"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom")
begin
end;
Parameters:
ToServiceHeader: The target Service Header to be updated.ServiceDocumentTypeFrom: The source document type that is not handled by standard cases.
Remarks: This event is fired in the CopyServiceDocumentUpdateHeader procedure when the source document type does not match any of the standard cases handled by the copy logic.
Standard cases handled by default:
- Quote, Order, Invoice, Credit Memo (unposted documents)
- Posted Shipment, Posted Invoice, Posted Credit Memo
- Arch. Quote, Arch. Order (archived documents)
Subscribers should handle header updates for:
- Custom document types added through extension
- Special KUMAVISION document type variations
- Any non-standard document types in the enum
Subscribers are responsible for:
- Retrieving the appropriate source document
- Copying relevant fields to ToServiceHeader
- Handling document-specific field mappings
- Preserving or resetting key fields as appropriate
Use cases:
- Supporting custom document workflows
- Implementing extension-specific document types
- Handling KUMAVISION-specific document variations
- Providing tenant-specific document type support
Related to CopyServiceDocumentUpdateHeader local procedure.
OnBeforeCopyDocumentProcessID(Record Service Header, Record Service Header, Boolean, Boolean) :#
Summary: Integration event raised before copying the document process ID from source to target.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyDocumentProcessID(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"; GlobalCopyDocProcID: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyDocumentProcessID', '', false, false)]
local procedure DoSomethingOnBeforeCopyDocumentProcessID(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"; GlobalCopyDocProcID: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
ToServiceHeader: The target Service Header receiving the document process ID.FromServiceHeader: The source Service Header containing the original document process ID.GlobalCopyDocProcID: Flag indicating whether to copy (TRUE) or generate new (FALSE) process ID.IsHandled: Set to TRUE to bypass standard document process ID handling.
Remarks: This event allows subscribers to: - Implement custom document process ID logic - Override standard process ID copying behavior - Apply business rules for process ID assignment - Integrate with custom document tracking systems
Document Process ID (KVSKBADocumentProcessID) is a KUMAVISION-specific field used to:
- Track document lineage and relationships
- Group related documents in workflows
- Link documents across different types (Quote → Order → Invoice)
- Support custom reporting and analytics
Standard behavior:
- If GlobalCopyDocProcID = TRUE: Copies process ID from source to target
- If GlobalCopyDocProcID = FALSE: Generates a new GUID for the target
When IsHandled is set to TRUE, subscribers must handle process ID assignment completely,
including any necessary validation or logging.
Use cases:
- Implementing custom process ID generation algorithms
- Conditionally linking documents based on business rules
- Integrating with external workflow systems
- Creating hierarchical document relationships
- Implementing tenant-specific document tracking
Related to CopyDocumentProcessID local procedure.
OnBeforeCreateLines(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Integer, Boolean) :#
Summary: Integration event raised before creating service item lines and service lines in the target document.
[IntegrationEvent(false, false)]
local procedure OnBeforeCreateLines(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCreateLines', '', false, false)]
local procedure DoSomethingOnBeforeCreateLines(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source document type.FromDocumentNo: The source document number.ToServiceHeader: The target Service Header to which lines will be added.NextItemLineNo: The starting line number for service item lines.IsHandled: Set to TRUE to bypass standard line creation logic.
Remarks: This is the master integration event for the line creation process. It allows subscribers to: - Completely replace standard line creation logic - Implement custom line copying workflows - Conditionally prevent line creation based on business rules - Apply custom filtering or transformation during line copy
When IsHandled is set to TRUE, subscribers must handle:
- Creating all service item lines from source
- Creating all service lines associated with each item line
- Copying KUMAVISION extension data (texts, price calc lines, etc.)
- Validating line quantities and prices
- Handling recalculation if GlobalRecalculateLines = TRUE
This event fires after:
- Header has been updated (if GlobalIncludeHeader = TRUE)
- Existing lines have been deleted (if including header)
- Document is ready to receive new lines
Standard line creation handles:
- Service item lines from various source types
- Service lines associated with each item line
- Different source document types (unposted, posted, archived)
- Price recalculation based on settings
- Text copying or updating based on settings
Use cases:
- Implementing completely custom line copy logic
- Filtering lines based on custom criteria
- Applying business rules during line creation
- Integrating with external systems during copy
- Implementing tenant-specific line handling
Related to CreateLines local procedure.
OnBeforeCopyServiceLineFromServiceShipmentLine(Record Service Header, Record Service Shipment Line, Boolean, Boolean) :#
Summary: Integration event raised before copying a service line from a posted service shipment.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceLineFromServiceShipmentLine(ServiceHeader: Record "Service Header"; ServiceShipmentLine: Record "Service Shipment Line"; CreateItemLines: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceLineFromServiceShipmentLine', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceLineFromServiceShipmentLine(ServiceHeader: Record "Service Header"; ServiceShipmentLine: Record "Service Shipment Line"; CreateItemLines: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceShipmentLine: The posted Service Shipment Line being copied from.CreateItemLines: If TRUE, service item lines will be created; if FALSE, lines are created without item lines.IsHandled: Set to TRUE to bypass standard line copy logic from shipment.
Remarks: This event allows subscribers to: - Override standard line copying from posted shipments - Implement custom field mappings from shipment lines - Conditionally prevent line copying based on business rules - Apply custom transformations to shipment line data
When IsHandled is set to TRUE, subscribers must handle:
- Creating and initializing the service line
- Transferring fields from ServiceShipmentLine to new line
- Assigning correct document type and number
- Handling service item line number (based on CreateItemLines)
- Copying KUMAVISION extension data from posted documents
- Performing validation
CreateItemLines parameter:
- TRUE: Creates service item lines and associates lines with them
- FALSE: Creates standalone service lines without item line association
Typical use case: Copying from a posted shipment to create a service invoice or credit memo.
The shipment represents already delivered/performed services that need to be invoiced.
Use cases:
- Customizing which fields are copied from shipments
- Implementing tenant-specific copy rules for posted documents
- Filtering shipment lines based on custom criteria
- Applying business logic during document conversion
- Handling KUMAVISION-specific shipment fields
Related to CopyServiceLineFromServiceShipmentLine local procedure.
OnAfterCopyServiceLineFromServiceShipmentLine(Record Service Header, Record Service Shipment Line, Boolean) :#
Summary: Integration event raised after copying a service line from a posted service shipment.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceLineFromServiceShipmentLine(ServiceHeader: Record "Service Header"; ServiceShipmentLine: Record "Service Shipment Line"; CreateItemLines: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceLineFromServiceShipmentLine', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceLineFromServiceShipmentLine(ServiceHeader: Record "Service Header"; ServiceShipmentLine: Record "Service Shipment Line"; CreateItemLines: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceShipmentLine: The posted Service Shipment Line that was copied from.CreateItemLines: Indicates whether service item lines were created.
Remarks: This event allows subscribers to: - Post-process lines copied from posted shipments - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard line copy from shipment has completed, including:
- Service line created with fields transferred from shipment
- Service item line number assigned (if CreateItemLines = TRUE)
- Line validated and checked
- KUMAVISION extension data copied from posted shipment
Use cases:
- Copying additional custom extension tables from shipments
- Recalculating fields for invoicing purposes
- Creating audit log entries for posted document references
- Triggering workflows or notifications
- Updating custom statistics or reporting tables
- Linking to external invoicing systems
- Implementing custom shipment-to-invoice transformations
Example: After copying from a shipment, subscribers might calculate warranty periods
or service agreement allocations for invoicing purposes.
Related to CopyServiceLineFromServiceShipmentLine local procedure.
OnBeforeCopyServiceLineFromServiceInvoiceLine(Record Service Header, Record Service Invoice Line, Integer, Boolean) :#
Summary: Integration event raised before copying a service line from a posted service invoice.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceLineFromServiceInvoiceLine(ServiceHeader: Record "Service Header"; ServiceInvoiceLine: Record "Service Invoice Line"; ServiceItemLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceLineFromServiceInvoiceLine', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceLineFromServiceInvoiceLine(ServiceHeader: Record "Service Header"; ServiceInvoiceLine: Record "Service Invoice Line"; ServiceItemLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceInvoiceLine: The posted Service Invoice Line being copied from.ServiceItemLineNo: The service item line number to assign to the new line.IsHandled: Set to TRUE to bypass standard line copy logic from invoice.
Remarks: This event allows subscribers to: - Override standard line copying from posted invoices - Implement custom field mappings from invoice lines - Conditionally prevent line copying based on business rules - Apply custom transformations to invoice line data
When IsHandled is set to TRUE, subscribers must handle:
- Creating and initializing the service line
- Transferring fields from ServiceInvoiceLine to new line
- Assigning correct document type, number, and service item line number
- Copying KUMAVISION extension data from posted invoice
- Performing validation
Typical use case: Copying from a posted invoice to create a credit memo or corrective document.
The invoice represents already invoiced services that need to be credited or referenced.
Key considerations:
- Prices are typically copied as-is from the invoice
- Quantities may need sign reversal for credit memos
- Original invoice references should be preserved
- KUMAVISION price calculation history is maintained
Use cases:
- Customizing which fields are copied from invoices
- Implementing tenant-specific copy rules for posted documents
- Filtering invoice lines based on custom criteria
- Applying business logic during credit memo creation
- Handling KUMAVISION-specific invoice fields
- Implementing custom invoice-to-credit memo transformations
Related to CopyServiceLineFromServiceInvoiceLine local procedure.
OnAfterCopyServiceLineFromServiceInvoiceLine(Record Service Header, Record Service Invoice Line, Integer) :#
Summary: Integration event raised after copying a service line from a posted service invoice.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceLineFromServiceInvoiceLine(ServiceHeader: Record "Service Header"; ServiceInvoiceLine: Record "Service Invoice Line"; ServiceItemLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceLineFromServiceInvoiceLine', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceLineFromServiceInvoiceLine(ServiceHeader: Record "Service Header"; ServiceInvoiceLine: Record "Service Invoice Line"; ServiceItemLineNo: Integer)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceInvoiceLine: The posted Service Invoice Line that was copied from.ServiceItemLineNo: The service item line number assigned to the new line.
Remarks: This event allows subscribers to: - Post-process lines copied from posted invoices - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard line copy from invoice has completed, including:
- Service line created with fields transferred from invoice
- Service item line number assigned
- Line validated and checked
- KUMAVISION extension data copied from posted invoice (prices, texts, etc.)
Use cases:
- Copying additional custom extension tables from invoices
- Recalculating fields for credit memo purposes
- Creating audit log entries for posted invoice references
- Implementing custom credit memo logic
- Updating custom statistics or reporting tables
- Linking to external credit management systems
- Implementing warranty or service agreement adjustments
Example: After copying from an invoice to a credit memo, subscribers might automatically
reverse warranty charges or adjust service agreement allocations.
Related to CopyServiceLineFromServiceInvoiceLine local procedure.
OnBeforeCopyServiceLineFromServiceCrMemoLine(Record Service Header, Record Service Cr.Memo Line, Integer, Boolean) :#
Summary: Integration event raised before copying a service line from a posted service credit memo.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceLineFromServiceCrMemoLine(ServiceHeader: Record "Service Header"; ServiceCrMemoLine: Record "Service Cr.Memo Line"; ServiceItemLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceLineFromServiceCrMemoLine', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceLineFromServiceCrMemoLine(ServiceHeader: Record "Service Header"; ServiceCrMemoLine: Record "Service Cr.Memo Line"; ServiceItemLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceCrMemoLine: The posted Service Credit Memo Line being copied from.ServiceItemLineNo: The service item line number to assign to the new line.IsHandled: Set to TRUE to bypass standard line copy logic from credit memo.
Remarks: This event allows subscribers to: - Override standard line copying from posted credit memos - Implement custom field mappings from credit memo lines - Conditionally prevent line copying based on business rules - Apply custom transformations to credit memo line data
When IsHandled is set to TRUE, subscribers must handle:
- Creating and initializing the service line
- Transferring fields from ServiceCrMemoLine to new line
- Assigning correct document type, number, and service item line number
- Copying KUMAVISION extension data from posted credit memo
- Performing validation
Typical use case: Copying from a posted credit memo to create a corrective invoice or
reference document. The credit memo represents credited services that may need to be
re-invoiced or referenced.
Key considerations:
- Credit memo quantities are typically negative
- May need sign reversal when copying to new invoice
- Original credit memo references should be preserved
- KUMAVISION price calculation history is maintained
Use cases:
- Customizing which fields are copied from credit memos
- Implementing tenant-specific copy rules for posted documents
- Filtering credit memo lines based on custom criteria
- Applying business logic during document conversion
- Handling KUMAVISION-specific credit memo fields
- Implementing custom credit memo transformations
Related to CopyServiceLineFromServiceCrMemoLine local procedure.
OnAfterCopyServiceLineFromServiceCrMemoLine(Record Service Header, Record Service Cr.Memo Line, Integer) :#
Summary: Integration event raised after copying a service line from a posted service credit memo.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceLineFromServiceCrMemoLine(ServiceHeader: Record "Service Header"; ServiceCrMemoLine: Record "Service Cr.Memo Line"; ServiceItemLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceLineFromServiceCrMemoLine', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceLineFromServiceCrMemoLine(ServiceHeader: Record "Service Header"; ServiceCrMemoLine: Record "Service Cr.Memo Line"; ServiceItemLineNo: Integer)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceCrMemoLine: The posted Service Credit Memo Line that was copied from.ServiceItemLineNo: The service item line number assigned to the new line.
Remarks: This event allows subscribers to: - Post-process lines copied from posted credit memos - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard line copy from credit memo has completed, including:
- Service line created with fields transferred from credit memo
- Service item line number assigned
- Line validated and checked
- KUMAVISION extension data copied from posted credit memo
Use cases:
- Copying additional custom extension tables from credit memos
- Recalculating fields when copying to invoice
- Creating audit log entries for posted credit memo references
- Implementing custom document conversion logic
- Updating custom statistics or reporting tables
- Linking to external systems
- Handling quantity sign reversal if needed
Example: After copying from a credit memo to a new invoice, subscribers might recalculate
warranty periods or service agreement allocations with positive quantities.
Related to CopyServiceLineFromServiceCrMemoLine local procedure.
OnAfterCopyDocumentProcessID(Record Service Header, Record Service Header) :#
Summary: Integration event raised after the document process ID has been copied or generated.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyDocumentProcessID(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyDocumentProcessID', '', false, false)]
local procedure DoSomethingOnAfterCopyDocumentProcessID(var ToServiceHeader: Record "Service Header"; FromServiceHeader: Record "Service Header")
begin
end;
Parameters:
ToServiceHeader: The target Service Header that received the document process ID.FromServiceHeader: The source Service Header containing the original document process ID.
Remarks: This event allows subscribers to: - Post-process the document process ID after assignment - Log or audit process ID assignments - Create related tracking records - Synchronize with external document management systems
At this point, the document process ID has been set on ToServiceHeader:
- Either copied from FromServiceHeader (if GlobalCopyDocumentProcessID = TRUE)
- Or generated as a new GUID (if GlobalCopyDocumentProcessID = FALSE)
Document Process ID (KVSKBADocumentProcessID) is a KUMAVISION-specific field used to:
- Track document lineage and relationships
- Group related documents in workflows
- Link documents across different types (Quote → Order → Invoice)
- Support custom reporting and analytics
Use cases:
- Creating document relationship tracking records
- Logging process ID assignments for audit purposes
- Triggering workflows based on document relationships
- Synchronizing with external tracking systems
- Implementing custom document hierarchy logic
- Updating custom statistics or reporting tables
Example: After assigning a process ID, subscribers might create a document relationship
record linking the source and target documents for reporting purposes.
Related to CopyDocumentProcessID local procedure.
OnBeforeInitAndCheckServiceDocuments(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Record Service Header, Record Service Shipment Header, Record Service Invoice Header, Record Service Cr.Memo Header, Boolean, Boolean) :#
Summary: Integration event raised before initializing and validating source and target service documents.
[IntegrationEvent(false, false)]
local procedure OnBeforeInitAndCheckServiceDocuments(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocNo: Code[20]; var ToServiceHeader: Record "Service Header"; var FromServiceHeader: Record "Service Header"; var FromServiceShipmentHeader: Record "Service Shipment Header"; var FromServiceInvoiceHeader: Record "Service Invoice Header"; var FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; var Result: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeInitAndCheckServiceDocuments', '', false, false)]
local procedure DoSomethingOnBeforeInitAndCheckServiceDocuments(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocNo: Code[20]; var ToServiceHeader: Record "Service Header"; var FromServiceHeader: Record "Service Header"; var FromServiceShipmentHeader: Record "Service Shipment Header"; var FromServiceInvoiceHeader: Record "Service Invoice Header"; var FromServiceCrMemoHeader: Record "Service Cr.Memo Header"; var Result: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source document type to copy from.FromDocNo: The source document number to copy from.ToServiceHeader: The target Service Header to copy to.FromServiceHeader: The source Service Header (will be populated if copying from unposted document).FromServiceShipmentHeader: The source Service Shipment Header (will be populated if copying from posted shipment).FromServiceInvoiceHeader: The source Service Invoice Header (will be populated if copying from posted invoice).FromServiceCrMemoHeader: The source Service Credit Memo Header (will be populated if copying from posted credit memo).Result: Set to FALSE to abort the copy operation.IsHandled: Set to TRUE to bypass standard initialization and validation logic.
Remarks: This event allows subscribers to: - Override standard document initialization and validation - Implement custom document retrieval logic - Perform pre-validation before copy begins - Abort the copy operation based on custom business rules
When IsHandled is set to TRUE, subscribers must:
- Retrieve the source document and populate the appropriate From...Header parameter
- Validate that the source document exists
- Validate that the source document is suitable for copying
- Set Result to TRUE to continue or FALSE to abort
Standard initialization and validation:
- Retrieves the source document based on ServiceDocumentTypeFrom
- Validates source document exists
- Checks source/target compatibility
- Populates the appropriate From...Header record
Use cases:
- Implementing custom document validation rules
- Supporting custom document types or workflows
- Enforcing tenant-specific copy restrictions
- Integrating with external systems for document retrieval
- Adding custom pre-copy business logic
- Checking permissions or approvals before copy
Example: Subscribers might enforce that quotes can only be copied to orders if
they have been approved, or check customer credit limits before copying.
Related to InitAndCheckServiceDocuments local procedure.
OnBeforeCopyAddedTablesFromUnPostedDocs(Record Service Line, Record Service Line, Boolean) :#
Summary: Integration event raised before copying KUMAVISION extension data from unposted service documents.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyAddedTablesFromUnPostedDocs(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyAddedTablesFromUnPostedDocs', '', false, false)]
local procedure DoSomethingOnBeforeCopyAddedTablesFromUnPostedDocs(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"; var IsHandled: Boolean)
begin
end;
Parameters:
ToServiceLine: The target Service Line to which data will be copied.FromServiceLine: The source Service Line being copied from.IsHandled: Set to TRUE to bypass standard copy logic for added tables.
Remarks: This event allows subscribers to: - Override standard copying of KUMAVISION extension data from unposted documents - Implement custom data copying logic for extension tables - Conditionally prevent copying based on custom rules - Apply transformations to extension data during copy
KUMAVISION extension data includes:
- Document texts (ServiceDocumentText table)
- Price calculation lines (ServicePriceCalcLine table)
- Discount calculation lines (ServiceDiscCalcLine table)
- Custom line-level attributes
When IsHandled is set to TRUE, subscribers must implement the complete copy logic
for all required extension tables.
Difference from OnBeforeCopyAddedTablesFromPostedDocs:
- This event handles unposted documents (Quote, Order, Invoice, Credit Memo)
- OnBeforeCopyAddedTablesFromPostedDocs handles posted documents (Shipment, Posted Invoice, Posted Credit Memo)
Use cases:
- Customizing what extension data is copied between unposted documents
- Implementing tenant-specific copy rules
- Filtering or transforming extension data during copy
- Adding validation or logging for copied data
- Supporting custom extension tables
Related to CopyAddedTablesFromUnPostedDocs local procedure.
OnAfterCopyAddedTablesFromUnPostedDocs(Record Service Line, Record Service Line) :#
Summary: Integration event raised after copying KUMAVISION extension data from unposted service documents.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyAddedTablesFromUnPostedDocs(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyAddedTablesFromUnPostedDocs', '', false, false)]
local procedure DoSomethingOnAfterCopyAddedTablesFromUnPostedDocs(var ToServiceLine: Record "Service Line"; FromServiceLine: Record "Service Line")
begin
end;
Parameters:
ToServiceLine: The target Service Line to which data was copied.FromServiceLine: The source Service Line that was copied from.
Remarks: This event allows subscribers to: - Post-process KUMAVISION extension data after it has been copied - Add additional extension tables not handled by standard logic - Validate or transform copied data - Synchronize related records in custom tables
At this point, standard KUMAVISION extension data has been copied from unposted documents, including:
- Document texts
- Price calculation lines
- Discount calculation lines
Use cases:
- Copying additional custom extension tables
- Recalculating fields based on copied data
- Triggering workflows or notifications
- Creating audit log entries
- Updating custom statistics or reporting tables
- Implementing custom data transformations
Example: After copying between unposted documents, subscribers might copy additional
custom warranty tracking or service agreement allocation data.
Related to CopyAddedTablesFromUnPostedDocs local procedure.
OnAfterCreateLines(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Integer) :#
Summary: Integration event raised after creating service item lines and service lines in the target document.
[IntegrationEvent(false, false)]
local procedure OnAfterCreateLines(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCreateLines', '', false, false)]
local procedure DoSomethingOnAfterCreateLines(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source document type.FromDocumentNo: The source document number.ToServiceHeader: The target Service Header to which lines were added.NextItemLineNo: The next available line number for service item lines.
Remarks: This event allows subscribers to: - Post-process created lines after standard copy - Add additional lines not handled by standard logic - Perform validation or business logic after line creation - Update related records or statistics
At this point, all standard line creation has completed:
- Service item lines created from source
- Service lines created and associated with item lines
- KUMAVISION extension data copied (texts, price calc lines, etc.)
- Prices recalculated if GlobalRecalculateLines = TRUE
- Lines validated and checked
Use cases:
- Creating additional custom lines (e.g., automatic fee lines)
- Recalculating totals or dependent fields
- Triggering workflows or notifications
- Creating audit log entries
- Updating custom statistics or reporting tables
- Implementing custom post-copy business logic
- Synchronizing with external systems
Example: After copying lines, subscribers might automatically add service agreement
allocation lines or warranty period lines based on the copied items.
Related to CreateLines local procedure.
OnAfterCopyServiceDocument(Record Service Header, Enum KVSKBAServiceDocumentTypeFrom, Code[20]) :#
Summary: Integration event raised after the complete service document copy process has finished.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceDocument(var ToServiceHeader: Record "Service Header"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceDocument', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceDocument(var ToServiceHeader: Record "Service Header"; ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocNo: Code[20])
begin
end;
Parameters:
ToServiceHeader: The target Service Header that was updated with copied data.ServiceDocumentTypeFrom: The source document type.FromDocNo: The source document number.
Remarks: This is the final integration event in the document copy process. It allows subscribers to: - Post-process the copied document - Perform final validation or business logic - Trigger workflows or notifications - Create audit log entries - Update related records or statistics
At this point, the complete copy operation has finished:
- Header fields copied (if GlobalIncludeHeader = TRUE)
- Service item lines created
- Service lines created
- KUMAVISION extension data copied (texts, price calc lines, etc.)
- Prices recalculated if GlobalRecalculateLines = TRUE
- Document process ID handled
- Graduated pricing updated if configured
- All validations completed
Use cases:
- Performing final document validation
- Creating audit log entries with complete copy context
- Triggering approval workflows for copied documents
- Sending notifications about document copy
- Updating custom statistics or reporting tables
- Synchronizing with external systems
- Implementing custom post-copy business logic
Example: After copying a quote to an order, subscribers might automatically send
a notification to the assigned salesperson or update opportunity tracking records.
This is the last event in the CopyServiceDocument procedure - the counterpart to
OnBeforeCopyServiceDocument which fires at the beginning.
Related to CopyServiceDocument internal procedure.
OnBeforeCopyServiceItemLineFromServiceItemLine(Record Service Header, Record Service Item Line, Boolean) :#
Summary: Integration event raised before copying a service item line from one unposted service document to another.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceItemLineFromServiceItemLine(var ServiceHeader: Record "Service Header"; ServiceItemLine: Record "Service Item Line"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceItemLineFromServiceItemLine', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceItemLineFromServiceItemLine(var ServiceHeader: Record "Service Header"; ServiceItemLine: Record "Service Item Line"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceItemLine: The source Service Item Line being copied from.IsHandled: Set to TRUE to bypass standard service item line copy logic.
Remarks: This event allows subscribers to: - Override standard service item line copying between unposted documents - Implement custom item line copy logic - Conditionally prevent item line copying based on business rules - Apply custom field mappings or transformations
When IsHandled is set to TRUE, subscribers must:
- Create and initialize the target service item line
- Transfer fields from ServiceItemLine to the new line
- Clear system-generated fields (line number, etc.)
- Validate the new service item line
- Copy KUMAVISION extension data if needed
Service item lines represent service items (e.g., machines, equipment) that require service.
Each item line can have multiple service lines (parts, labor, etc.) associated with it.
Use cases:
- Customizing which fields are copied between documents
- Implementing tenant-specific copy rules
- Filtering item lines based on custom criteria
- Applying business logic during document conversion (e.g., Quote → Order)
- Modifying item line data during copy (e.g., warranty status, repair status)
- Implementing custom validation for item lines
Related to CopyServiceItemLineFromServiceItemLine local procedure.
OnAfterCopyServiceItemLineFromServiceItemLine(Record Service Header, Record Service Item Line) :#
Summary: Integration event raised after copying a service item line from one unposted service document to another.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceItemLineFromServiceItemLine(var ServiceHeader: Record "Service Header"; ServiceItemLine: Record "Service Item Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceItemLineFromServiceItemLine', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceItemLineFromServiceItemLine(var ServiceHeader: Record "Service Header"; ServiceItemLine: Record "Service Item Line")
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceItemLine: The source Service Item Line that was copied from.
Remarks: This event allows subscribers to: - Post-process copied service item lines - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard item line copy has completed:
- Service item line created with fields transferred
- System fields cleared and reinitialized
- Line validated and checked
- KUMAVISION extension data copied (if GlobalUpdateTexts = FALSE) or regenerated (if TRUE)
Use cases:
- Copying additional custom extension tables for item lines
- Recalculating item line dependent fields
- Creating audit log entries
- Triggering workflows or notifications for specific items
- Updating custom statistics or reporting tables
- Synchronizing data with external service management systems
- Implementing custom item line transformations
Example: After copying a service item line, subscribers might copy additional custom
warranty information or service history data not handled by standard logic.
Related to CopyServiceItemLineFromServiceItemLine local procedure.
OnBeforeCopyServiceItemLineFromServiceShipmentItemLine(Record Service Header, Record Service Shipment Item Line, Boolean) :#
Summary: Integration event raised before copying a service item line from a posted service shipment.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceItemLineFromServiceShipmentItemLine(var ServiceHeader: Record "Service Header"; ServiceShipmentItemLine: Record "Service Shipment Item Line"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceItemLineFromServiceShipmentItemLine', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceItemLineFromServiceShipmentItemLine(var ServiceHeader: Record "Service Header"; ServiceShipmentItemLine: Record "Service Shipment Item Line"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceShipmentItemLine: The posted Service Shipment Item Line being copied from.IsHandled: Set to TRUE to bypass standard item line copy logic from shipment.
Remarks: This event allows subscribers to: - Override standard item line copying from posted shipments - Implement custom field mappings from shipment item lines - Conditionally prevent item line copying based on business rules - Apply custom transformations to shipment item line data
When IsHandled is set to TRUE, subscribers must handle:
- Creating and initializing the service item line
- Transferring fields from ServiceShipmentItemLine to new line
- Clearing system-generated fields
- Validating the new item line
- Copying KUMAVISION extension data from posted shipment
Typical use case: Copying from a posted shipment to create a service invoice or credit memo
with item line context. The shipment represents already delivered/performed services.
Use cases:
- Customizing which fields are copied from shipment item lines
- Implementing tenant-specific copy rules for posted documents
- Filtering item lines based on custom criteria
- Applying business logic during document conversion
- Handling KUMAVISION-specific shipment item fields
Related to CopyServiceItemLineFromServiceShipmentItemLine local procedure.
OnAfterCopyServiceItemLineFromServiceShipmentItemLine(Record Service Header, Record Service Shipment Item Line) :#
Summary: Integration event raised after copying a service item line from a posted service shipment.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceItemLineFromServiceShipmentItemLine(var ServiceHeader: Record "Service Header"; ServiceShipmentItemLine: Record "Service Shipment Item Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceItemLineFromServiceShipmentItemLine', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceItemLineFromServiceShipmentItemLine(var ServiceHeader: Record "Service Header"; ServiceShipmentItemLine: Record "Service Shipment Item Line")
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceShipmentItemLine: The posted Service Shipment Item Line that was copied from.
Remarks: This event allows subscribers to: - Post-process item lines copied from posted shipments - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard item line copy from shipment has completed:
- Service item line created with fields transferred from shipment
- System fields cleared and reinitialized
- Line validated and checked
- KUMAVISION extension data copied from posted shipment
Use cases:
- Copying additional custom extension tables from shipment item lines
- Recalculating fields for invoicing purposes
- Creating audit log entries for posted document references
- Triggering workflows or notifications
- Updating custom statistics or reporting tables
- Implementing custom shipment-to-invoice transformations for item lines
Example: After copying from a shipment, subscribers might update warranty tracking
or service agreement allocation data for the item line.
Related to CopyServiceItemLineFromServiceShipmentItemLine local procedure.
OnBeforeCreateServiceItemLine(Record Service Header, Code[20], Code[20], Integer, Boolean) :#
Summary: Integration event raised before creating a new service item line in the target document.
[IntegrationEvent(false, false)]
local procedure OnBeforeCreateServiceItemLine(ServiceHeader: Record "Service Header"; ServiceItemNo: Code[20]; CustomerNo: Code[20]; var NextLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCreateServiceItemLine', '', false, false)]
local procedure DoSomethingOnBeforeCreateServiceItemLine(ServiceHeader: Record "Service Header"; ServiceItemNo: Code[20]; CustomerNo: Code[20]; var NextLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceItemNo: The service item number to be assigned (empty if creating without service item).CustomerNo: The customer number for validation.NextLineNo: The line number to be assigned to the new item line.IsHandled: Set to TRUE to bypass standard item line creation logic.
Remarks: This event allows subscribers to: - Override standard service item line creation - Implement custom item line initialization - Conditionally prevent item line creation based on business rules - Apply custom field population logic
When IsHandled is set to TRUE, subscribers must handle:
- Initializing and creating the service item line record
- Assigning document type, number, and line number
- Validating the service item number (if provided)
- Clearing appropriate fields
- Validating against customer
- Incrementing NextLineNo by 10000 (standard line number increment)
Service item lines can be created with or without a service item:
- With ServiceItemNo: Represents a specific registered service item (machine, equipment)
- Without ServiceItemNo: Generic service work not tied to a specific item
Use cases:
- Implementing custom item line creation logic
- Applying tenant-specific initialization rules
- Adding default values based on customer or item
- Implementing custom validation before creation
- Supporting custom item line types
Related to CreateServiceItemLine local procedure.
OnAfterCreateServiceItemLine(Record Service Header, Code[20], Code[20], Integer) :#
Summary: Integration event raised after creating a new service item line in the target document.
[IntegrationEvent(false, false)]
local procedure OnAfterCreateServiceItemLine(ServiceHeader: Record "Service Header"; ServiceItemNo: Code[20]; CustomerNo: Code[20]; var NextLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCreateServiceItemLine', '', false, false)]
local procedure DoSomethingOnAfterCreateServiceItemLine(ServiceHeader: Record "Service Header"; ServiceItemNo: Code[20]; CustomerNo: Code[20]; var NextLineNo: Integer)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceItemNo: The service item number that was assigned (empty if created without service item).CustomerNo: The customer number used for validation.NextLineNo: The line number that was assigned to the new item line.
Remarks: This event allows subscribers to: - Post-process newly created service item lines - Add additional custom fields or extension data - Perform additional validation or business logic - Update related records or statistics
At this point, the service item line has been created and initialized:
- Line number assigned and incremented
- Service item number validated (if provided)
- Description set (either from item or default text)
- System fields cleared
- Customer validation completed
Use cases:
- Adding custom default values to new item lines
- Creating related custom extension records
- Triggering workflows or notifications
- Updating custom statistics or reporting tables
- Implementing custom item line initialization logic
Example: After creating an item line, subscribers might automatically create
related warranty tracking records or service agreement allocation entries.
Related to CreateServiceItemLine local procedure.
OnBeforeCheckServiceItemLine(Record Service Item Line, Code[20], Boolean) :#
Summary: Integration event raised before validating a service item line after copying.
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckServiceItemLine(var ToServiceItemLine: Record "Service Item Line"; CustomerNo: Code[20]; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCheckServiceItemLine', '', false, false)]
local procedure DoSomethingOnBeforeCheckServiceItemLine(var ToServiceItemLine: Record "Service Item Line"; CustomerNo: Code[20]; var IsHandled: Boolean)
begin
end;
Parameters:
ToServiceItemLine: The service item line to be validated.CustomerNo: The customer number for validation.IsHandled: Set to TRUE to bypass standard validation logic.
Remarks: This event allows subscribers to: - Override standard service item line validation - Implement custom validation rules - Conditionally skip validation based on business rules - Apply custom checks or corrections
When IsHandled is set to TRUE, subscribers must handle:
- Validating customer number compatibility
- Checking if customer owns the service item
- Any required field validations
- Applying any necessary corrections
Standard validation checks:
- Customer number matches the service item's customer
- Service item is not blocked
- Other business rule validations
Use cases:
- Implementing custom validation rules for item lines
- Bypassing validation in specific scenarios
- Adding tenant-specific checks
- Implementing custom error handling
- Applying automatic corrections during copy
Related to CheckServiceItemLine local procedure.
OnAfterCheckServiceItemLine(Record Service Item Line, Code[20]) :#
Summary: Integration event raised after validating a service item line after copying.
[IntegrationEvent(false, false)]
local procedure OnAfterCheckServiceItemLine(var ToServiceItemLine: Record "Service Item Line"; CustomerNo: Code[20]):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCheckServiceItemLine', '', false, false)]
local procedure DoSomethingOnAfterCheckServiceItemLine(var ToServiceItemLine: Record "Service Item Line"; CustomerNo: Code[20])
begin
end;
Parameters:
ToServiceItemLine: The service item line that was validated.CustomerNo: The customer number used for validation.
Remarks: This event allows subscribers to: - Perform additional validation after standard checks - Apply custom business logic post-validation - Update related records or statistics - Log validation results
At this point, standard validation has completed:
- Customer number validated
- Service item ownership verified
- Business rule checks passed
Use cases:
- Adding custom post-validation checks
- Creating audit log entries for validation
- Triggering notifications for specific validation results
- Updating custom statistics or reporting tables
- Implementing custom post-validation actions
Related to CheckServiceItemLine local procedure.
OnBeforeCheckServiceLine(Record Service Line, Code[20], Code[20], Decimal, Boolean, Boolean) :#
Summary: Integration event raised before validating a service line after copying.
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckServiceLine(var ServiceLine: Record "Service Line"; CustomerNo: Code[20]; No: Code[20]; Qty: Decimal; RecalculateLines: Boolean; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCheckServiceLine', '', false, false)]
local procedure DoSomethingOnBeforeCheckServiceLine(var ServiceLine: Record "Service Line"; CustomerNo: Code[20]; No: Code[20]; Qty: Decimal; RecalculateLines: Boolean; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceLine: The service line to be validated.CustomerNo: The customer number for validation.No: The item/resource number for validation.Qty: The quantity for validation.RecalculateLines: Indicates whether lines are being recalculated.IsHandled: Set to TRUE to bypass standard validation logic.
Remarks: This event allows subscribers to: - Override standard service line validation - Implement custom validation rules - Conditionally skip validation based on business rules - Apply custom checks or corrections
When IsHandled is set to TRUE, subscribers must handle:
- Validating customer number if required
- Validating item/resource number
- Validating quantity
- Recalculating prices if RecalculateLines = TRUE
- Modifying the service line record
Standard validation and processing:
- Validates customer number (triggers price recalculation)
- Validates item/resource number if RecalculateLines = TRUE
- Validates quantity if RecalculateLines = TRUE
- Updates line with validated values
Use cases:
- Implementing custom validation rules for service lines
- Bypassing validation in specific scenarios
- Adding tenant-specific checks
- Implementing custom recalculation logic
- Applying automatic corrections during copy
Related to CheckServiceLine local procedure.
OnAfterCheckServiceLine(Record Service Line, Code[20], Code[20], Decimal, Boolean) :#
Summary: Integration event raised after validating a service line after copying.
[IntegrationEvent(false, false)]
local procedure OnAfterCheckServiceLine(var ServiceLine: Record "Service Line"; CustomerNo: Code[20]; No: Code[20]; Qty: Decimal; RecalculateLines: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCheckServiceLine', '', false, false)]
local procedure DoSomethingOnAfterCheckServiceLine(var ServiceLine: Record "Service Line"; CustomerNo: Code[20]; No: Code[20]; Qty: Decimal; RecalculateLines: Boolean)
begin
end;
Parameters:
ServiceLine: The service line that was validated.CustomerNo: The customer number used for validation.No: The item/resource number used for validation.Qty: The quantity that was validated.RecalculateLines: Indicates whether lines were recalculated.
Remarks: This event allows subscribers to: - Perform additional validation after standard checks - Apply custom business logic post-validation - Update related records or statistics - Log validation results
At this point, standard validation has completed:
- Customer number validated
- Item/resource number validated (if RecalculateLines = TRUE)
- Quantity validated (if RecalculateLines = TRUE)
- Prices recalculated (if RecalculateLines = TRUE)
- Service line updated with validated values
Use cases:
- Adding custom post-validation checks
- Applying additional business rules
- Creating audit log entries for validation
- Triggering notifications for specific validation results
- Updating custom statistics or reporting tables
- Implementing custom post-validation actions
Related to CheckServiceLine local procedure.
OnCheckServiceLineOnBeforeModifyServiceLine(Record Service Line, Boolean) :#
Summary: Integration event raised in CheckServiceLine immediately before modifying the service line record.
[IntegrationEvent(false, false)]
local procedure OnCheckServiceLineOnBeforeModifyServiceLine(var ServiceLine: Record "Service Line"; RecalculateLines: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnCheckServiceLineOnBeforeModifyServiceLine', '', false, false)]
local procedure DoSomethingOnCheckServiceLineOnBeforeModifyServiceLine(var ServiceLine: Record "Service Line"; RecalculateLines: Boolean)
begin
end;
Parameters:
ServiceLine: The service line to be modified.RecalculateLines: Indicates whether lines are being recalculated.
Remarks: This event allows subscribers to: - Make final adjustments to the service line before modification - Apply custom business logic just before saving - Override or adjust validated values - Add custom field calculations
At this point:
- All validations have been completed
- Customer number has been validated
- Item/resource number validated (if RecalculateLines = TRUE)
- Quantity validated (if RecalculateLines = TRUE)
- Prices calculated
- Line is about to be modified/saved
Use cases:
- Making last-minute field adjustments
- Applying custom calculations based on validated values
- Setting custom flags or status fields
- Implementing tenant-specific field logic
- Overriding calculated values with custom logic
Example: Subscribers might apply custom discounts or surcharges based on
the validated customer and item combination before the line is saved.
Related to CheckServiceLine local procedure.
OnBeforeClearServiceHeaderFields(Record Service Header, Boolean) :#
Summary: Integration event raised before clearing system-generated fields in a copied service header.
[IntegrationEvent(false, false)]
local procedure OnBeforeClearServiceHeaderFields(var ServiceHeader: Record "Service Header"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeClearServiceHeaderFields', '', false, false)]
local procedure DoSomethingOnBeforeClearServiceHeaderFields(var ServiceHeader: Record "Service Header"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The service header whose fields will be cleared.IsHandled: Set to TRUE to bypass standard field clearing logic.
Remarks: This event allows subscribers to: - Override which fields are cleared in the service header - Implement custom field clearing logic - Preserve additional fields during copy - Apply custom business rules for field handling
When IsHandled is set to TRUE, subscribers must handle clearing of appropriate system fields.
Standard fields cleared by default:
- Status (reset to Pending)
- Release-related fields
- Posting-related fields (Posting No., Shipping No., etc.)
- System timestamps
- Other system-generated values
Fields that should NOT be cleared:
- Document Type, Document No. (target document identity)
- Customer information (if copied from source)
- User-entered business data
Use cases:
- Customizing which fields are cleared during copy
- Preserving additional custom fields
- Implementing tenant-specific field clearing rules
- Applying custom status or workflow fields
Related to ClearServiceHeaderFields local procedure.
OnAfterClearServiceHeaderFields(Record Service Header) :#
Summary: Integration event raised after clearing system-generated fields in a copied service header.
[IntegrationEvent(false, false)]
local procedure OnAfterClearServiceHeaderFields(var ServiceHeader: Record "Service Header"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterClearServiceHeaderFields', '', false, false)]
local procedure DoSomethingOnAfterClearServiceHeaderFields(var ServiceHeader: Record "Service Header")
begin
end;
Parameters:
ServiceHeader: The service header whose fields were cleared.
Remarks: This event allows subscribers to: - Perform additional field clearing or initialization - Set custom default values after clearing - Apply custom business logic after clearing - Update related records
At this point, standard system fields have been cleared:
- Status reset to appropriate default
- Posting-related fields cleared
- System timestamps reset
- Other system-generated values cleared
Use cases:
- Clearing additional custom fields
- Setting custom default values for extension fields
- Applying tenant-specific initialization logic
- Updating custom status or workflow fields
- Creating audit log entries
Example: After clearing standard fields, subscribers might initialize custom
workflow status fields or set default values for extension fields.
Related to ClearServiceHeaderFields local procedure.
OnBeforeClearServiceItemLineFields(Record Service Item Line, Boolean) :#
Summary: Integration event raised before clearing system-generated fields in a copied service item line.
[IntegrationEvent(false, false)]
local procedure OnBeforeClearServiceItemLineFields(var ServiceItemLine: Record "Service Item Line"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeClearServiceItemLineFields', '', false, false)]
local procedure DoSomethingOnBeforeClearServiceItemLineFields(var ServiceItemLine: Record "Service Item Line"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceItemLine: The service item line whose fields will be cleared.IsHandled: Set to TRUE to bypass standard field clearing logic.
Remarks: This event allows subscribers to: - Override which fields are cleared in the service item line - Implement custom field clearing logic - Preserve additional fields during copy - Apply custom business rules for field handling
When IsHandled is set to TRUE, subscribers must handle clearing of appropriate system fields.
Standard fields cleared by default:
- Repair Status Code
- Response Date/Time
- Starting Date/Time
- Finishing Date/Time
- System timestamps
- Other system-generated values
Fields that should NOT be cleared:
- Document Type, Document No., Line No. (target document identity)
- Service Item No. (item identity)
- Description and other user-entered data
Use cases:
- Customizing which fields are cleared during copy
- Preserving additional custom fields
- Implementing tenant-specific field clearing rules
- Applying custom status or workflow fields
Related to ClearServiceItemLineFields local procedure.
OnAfterClearServiceItemLineFields(Record Service Item Line) :#
Summary: Integration event raised after clearing system-generated fields in a copied service item line.
[IntegrationEvent(false, false)]
local procedure OnAfterClearServiceItemLineFields(var ServiceItemLine: Record "Service Item Line"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterClearServiceItemLineFields', '', false, false)]
local procedure DoSomethingOnAfterClearServiceItemLineFields(var ServiceItemLine: Record "Service Item Line")
begin
end;
Parameters:
ServiceItemLine: The service item line whose fields were cleared.
Remarks: This event allows subscribers to: - Perform additional field clearing or initialization - Set custom default values after clearing - Apply custom business logic after clearing - Update related records
At this point, standard system fields have been cleared:
- Repair status reset
- Date/time fields cleared
- System timestamps reset
- Other system-generated values cleared
Use cases:
- Clearing additional custom fields
- Setting custom default values for extension fields
- Applying tenant-specific initialization logic
- Updating custom status or workflow fields
- Creating audit log entries
Example: After clearing standard fields, subscribers might initialize custom
repair tracking fields or set default values for warranty-related extension fields.
Related to ClearServiceItemLineFields local procedure.
OnBeforeCopyServiceItemLineFromServiceItemLineArchive(Record Service Header, Record Service Item Line Archive, Boolean) :#
Summary: Integration event raised before copying a service item line from an archived document.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceItemLineFromServiceItemLineArchive(var ServiceHeader: Record "Service Header"; ServiceItemLineArchive: Record "Service Item Line Archive"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceItemLineFromServiceItemLineArchive', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceItemLineFromServiceItemLineArchive(var ServiceHeader: Record "Service Header"; ServiceItemLineArchive: Record "Service Item Line Archive"; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceItemLineArchive: The archived Service Item Line being copied from.IsHandled: Set to TRUE to bypass standard item line copy logic from archive.
Remarks: This event allows subscribers to: - Override standard item line copying from archived documents - Implement custom field mappings from archived item lines - Conditionally prevent item line copying based on business rules - Apply custom transformations to archived item line data
When IsHandled is set to TRUE, subscribers must handle:
- Creating and initializing the service item line
- Transferring fields from ServiceItemLineArchive to new line
- Clearing system-generated fields
- Validating the new item line
- Copying KUMAVISION extension data from archive
Archived documents represent historical versions of quotes and orders that were
archived before being deleted or converted. This allows restoring or referencing
previous document versions.
Use cases:
- Customizing which fields are copied from archived item lines
- Implementing tenant-specific copy rules for archived documents
- Filtering item lines based on custom criteria
- Applying business logic during archive restoration
- Handling KUMAVISION-specific archived fields
Related to CopyServiceItemLineFromServiceItemLineArchive local procedure.
OnAfterCopyServiceItemLineFromServiceItemLineArchive(Record Service Header, Record Service Item Line Archive) :#
Summary: Integration event raised after copying a service item line from an archived document.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceItemLineFromServiceItemLineArchive(var ServiceHeader: Record "Service Header"; ServiceItemLineArchive: Record "Service Item Line Archive"):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceItemLineFromServiceItemLineArchive', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceItemLineFromServiceItemLineArchive(var ServiceHeader: Record "Service Header"; ServiceItemLineArchive: Record "Service Item Line Archive")
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceItemLineArchive: The archived Service Item Line that was copied from.
Remarks: This event allows subscribers to: - Post-process item lines copied from archived documents - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard item line copy from archive has completed:
- Service item line created with fields transferred from archive
- System fields cleared and reinitialized
- Line validated and checked
- KUMAVISION extension data copied from archive or regenerated
Use cases:
- Copying additional custom extension tables from archived item lines
- Recalculating fields when restoring from archive
- Creating audit log entries for archive restoration
- Triggering workflows or notifications
- Updating custom statistics or reporting tables
- Implementing custom archive restoration logic
Example: After copying from an archive, subscribers might log the restoration
or update custom tracking fields to indicate the line was restored from archive.
Related to CopyServiceItemLineFromServiceItemLineArchive local procedure.
OnBeforeCopyServiceLineFromServiceLineArchiv(Record Service Header, Record Service Line Archive, Integer, Boolean) :#
Summary: Integration event raised before copying a service line from an archived document.
[IntegrationEvent(false, false)]
local procedure OnBeforeCopyServiceLineFromServiceLineArchiv(ServiceHeader: Record "Service Header"; ServiceLineArchive: Record "Service Line Archive"; ServiceItemLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCopyServiceLineFromServiceLineArchiv', '', false, false)]
local procedure DoSomethingOnBeforeCopyServiceLineFromServiceLineArchiv(ServiceHeader: Record "Service Header"; ServiceLineArchive: Record "Service Line Archive"; ServiceItemLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceLineArchive: The archived Service Line being copied from.ServiceItemLineNo: The service item line number to assign to the new line.IsHandled: Set to TRUE to bypass standard line copy logic from archive.
Remarks: This event allows subscribers to: - Override standard line copying from archived documents - Implement custom field mappings from archived lines - Conditionally prevent line copying based on business rules - Apply custom transformations to archived line data
When IsHandled is set to TRUE, subscribers must handle:
- Creating and initializing the service line
- Transferring fields from ServiceLineArchive to new line
- Assigning document type, number, and service item line number
- Copying KUMAVISION extension data from archive
- Performing validation
Archived documents represent historical versions of quotes and orders. This allows
restoring previous versions or creating new documents based on archived data.
Use cases:
- Customizing which fields are copied from archived lines
- Implementing tenant-specific copy rules for archived documents
- Filtering archived lines based on custom criteria
- Applying business logic during archive restoration
- Handling KUMAVISION-specific archived fields
- Implementing custom archive restoration workflows
Related to CopyServiceLineFromServiceLineArchiv local procedure.
OnAfterCopyServiceLineFromServiceLineArchiv(Record Service Header, Record Service Line, Record Service Line Archive, Integer) :#
Summary: Integration event raised after copying a service line from an archived document.
[IntegrationEvent(false, false)]
local procedure OnAfterCopyServiceLineFromServiceLineArchiv(ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; ServiceLineArchive: Record "Service Line Archive"; ServiceItemLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCopyServiceLineFromServiceLineArchiv', '', false, false)]
local procedure DoSomethingOnAfterCopyServiceLineFromServiceLineArchiv(ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; ServiceLineArchive: Record "Service Line Archive"; ServiceItemLineNo: Integer)
begin
end;
Parameters:
ServiceHeader: The target Service Header.ServiceLine: The newly created service line.ServiceLineArchive: The archived Service Line that was copied from.ServiceItemLineNo: The service item line number assigned to the new line.
Remarks: This event allows subscribers to: - Post-process lines copied from archived documents - Copy additional custom fields or extension data - Perform validation or business logic after standard copy - Update related records or statistics
At this point, the standard line copy from archive has completed:
- Service line created with fields transferred from archive
- Service item line number assigned
- Line validated and checked
- KUMAVISION extension data copied from archive or regenerated
Use cases:
- Copying additional custom extension tables from archived lines
- Recalculating fields when restoring from archive
- Creating audit log entries for archive restoration
- Triggering workflows or notifications
- Updating custom statistics or reporting tables
- Implementing custom archive restoration logic
- Synchronizing with external systems
Example: After copying from an archive, subscribers might recalculate current
prices or update custom tracking fields to indicate archive restoration.
Related to CopyServiceLineFromServiceLineArchiv local procedure.
OnBeforeCreateLinesFromArchive(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Integer, Boolean) :#
Summary: Integration event raised before creating lines from an archived service document.
[IntegrationEvent(false, false)]
local procedure OnBeforeCreateLinesFromArchive(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeCreateLinesFromArchive', '', false, false)]
local procedure DoSomethingOnBeforeCreateLinesFromArchive(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer; var IsHandled: Boolean)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source archived document type.FromDocumentNo: The source archived document number.ToServiceHeader: The target Service Header to which lines will be added.NextItemLineNo: The starting line number for service item lines.IsHandled: Set to TRUE to bypass standard archive line creation logic.
Remarks: This event allows subscribers to: - Completely replace standard line creation from archives - Implement custom archive restoration workflows - Conditionally prevent line creation based on business rules - Apply custom filtering or transformation during archive restoration
When IsHandled is set to TRUE, subscribers must handle:
- Creating all service item lines from archived source
- Creating all service lines associated with each item line
- Copying KUMAVISION extension data from archive
- Validating line quantities and prices
- Handling recalculation if GlobalRecalculateLines = TRUE
Archived documents (Arch. Quote, Arch. Order) represent historical versions that can be:
- Restored to active documents
- Used as templates for new documents
- Referenced for historical comparison
Use cases:
- Implementing completely custom archive restoration logic
- Filtering archived lines based on custom criteria
- Applying business rules during restoration
- Integrating with external systems during archive restoration
- Implementing tenant-specific archive handling
Related to CreateLinesFromArchive local procedure.
OnAfterCreateLinesFromArchive(Enum KVSKBAServiceDocumentTypeFrom, Code[20], Record Service Header, Integer) :#
Summary: Integration event raised after creating lines from an archived service document.
[IntegrationEvent(false, false)]
local procedure OnAfterCreateLinesFromArchive(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnAfterCreateLinesFromArchive', '', false, false)]
local procedure DoSomethingOnAfterCreateLinesFromArchive(ServiceDocumentTypeFrom: Enum "KVSKBAServiceDocumentTypeFrom"; FromDocumentNo: Code[20]; var ToServiceHeader: Record "Service Header"; NextItemLineNo: Integer)
begin
end;
Parameters:
ServiceDocumentTypeFrom: The source archived document type.FromDocumentNo: The source archived document number.ToServiceHeader: The target Service Header to which lines were added.NextItemLineNo: The next available line number for service item lines.
Remarks: This event allows subscribers to: - Post-process lines created from archived documents - Add additional lines not handled by standard logic - Perform validation or business logic after archive restoration - Update related records or statistics
At this point, all standard line creation from archive has completed:
- Service item lines created from archived source
- Service lines created and associated with item lines
- KUMAVISION extension data copied from archive or regenerated
- Prices recalculated if GlobalRecalculateLines = TRUE
- Lines validated and checked
Use cases:
- Creating additional custom lines after archive restoration
- Recalculating totals or dependent fields
- Triggering workflows or notifications for archive restoration
- Creating audit log entries
- Updating custom statistics or reporting tables
- Implementing custom post-restoration business logic
- Synchronizing with external systems
Example: After restoring lines from an archive, subscribers might automatically
update prices to current values or add notification lines about the restoration.
Related to CreateLinesFromArchive local procedure.
OnBeforeRestoreFieldsFromSavedServiceHeader(Record Service Header, Record Service Header, Boolean) :#
Summary: Event to restore fields from saved service header.
[IntegrationEvent(false, false)]
local procedure OnBeforeRestoreFieldsFromSavedServiceHeader(var ToServiceHeader: Record "Service Header"; OldServiceHeader: Record "Service Header"; var IsHandled: Boolean):
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBASrvCopyDocumentLib", 'OnBeforeRestoreFieldsFromSavedServiceHeader', '', false, false)]
local procedure DoSomethingOnBeforeRestoreFieldsFromSavedServiceHeader(var ToServiceHeader: Record "Service Header"; OldServiceHeader: Record "Service Header"; var IsHandled: Boolean)
begin
end;
Parameters:
ToServiceHeader: The target service header record.OldServiceHeader: The old saved service header record.IsHandled: Indicates if the event was handled.
Remarks: This event allows customization of the fields restored from the saved service header.