Ventoo Document Merger publishes integration events that allow other extensions to extend or modify the merge behavior.
Doc. Merge Management (Codeunit 70679850)
OnAfterMergeDocuments
Raised after the PDF merge process completes successfully. Use this event for logging or post-processing.
[IntegrationEvent(false, false)]
local procedure OnAfterMergeDocuments(SourceSystemID: Guid; DocType: Enum "Report Selection Usage")
|
Parameter |
Type |
Description |
|---|---|---|
|
SourceSystemID |
Guid |
The SystemId of the source document. |
|
DocType |
Enum "Report Selection Usage" |
The document type. |
Doc. Merge Rule Engine (Codeunit 70679851)
OnAfterBuildDocumentList
Raised after the document list has been built or rebuilt from rules, but before the page refreshes. Use this event to programmatically control the list composition – e.g. change the sequence, include/exclude entries, or set the "Attach Separately" flag.
This event is raised on every list build:
-
Initial build when the page opens for the first time
-
Manual reset via the "Reset" action on the Composition page
-
Automatic rebuild when attachments change (if active and not manually adjusted)
[IntegrationEvent(false, false)]
local procedure OnAfterBuildDocumentList(var DocumentListVTO: Record "Document List VTO"; SourceSystemID: Guid; SourceDocType: Enum "Report Selection Usage")
|
Parameter |
Type |
Description |
|---|---|---|
|
DocumentListVTO |
Record "Document List VTO" |
The document list, pre-filtered to the source document's |
|
SourceSystemID |
Guid |
The SystemId of the source document. |
|
SourceDocType |
Enum "Report Selection Usage" |
The document type (e.g., S.Invoice, P.Order). |
Doc. Merge PDF Handler (Codeunit 70679854)
OnBeforeProcessDocumentEntry
Raised before each individual document in the list is processed during PDF merging. Use this event to selectively skip specific documents from the merge while allowing others to proceed.
[IntegrationEvent(false, false)]
local procedure OnBeforeProcessDocumentEntry(DocListEntry: Record "Document List VTO"; var Skip: Boolean)
|
Parameter |
Type |
Description |
|---|---|---|
|
DocListEntry |
Record "Document List VTO" |
The document list entry about to be processed. Inspect its fields (Source Type, Document Name, File Extension, etc.) to decide. |
|
Skip |
Boolean |
Set to |
Doc. Merge Reminder Handler (Codeunit 70679856)
OnBeforeAttachInvoiceToReminder
Raised before a sales invoice PDF is attached to an issued reminder. Set IsHandled to true to prevent the attachment.
[IntegrationEvent(false, false)]
local procedure OnBeforeAttachInvoiceToReminder(var IssuedReminderHeader: Record "Issued Reminder Header"; var SalesInvoiceHeader: Record "Sales Invoice Header"; var IsHandled: Boolean)
|
Parameter |
Type |
Description |
|---|---|---|
|
IssuedReminderHeader |
Record "Issued Reminder Header" |
The issued reminder receiving the attachment. |
|
SalesInvoiceHeader |
Record "Sales Invoice Header" |
The sales invoice being attached. |
|
IsHandled |
Boolean |
Set to |
OnAfterAttachInvoiceToReminder
Raised after a sales invoice PDF has been successfully attached to an issued reminder.
[IntegrationEvent(false, false)]
local procedure OnAfterAttachInvoiceToReminder(IssuedReminderHeader: Record "Issued Reminder Header"; SalesInvoiceHeader: Record "Sales Invoice Header")
|
Parameter |
Type |
Description |
|---|---|---|
|
IssuedReminderHeader |
Record "Issued Reminder Header" |
The issued reminder that received the attachment. |
|
SalesInvoiceHeader |
Record "Sales Invoice Header" |
The sales invoice that was attached. |
Examples
Skip individual documents by name or type
[EventSubscriber(ObjectType::Codeunit, Codeunit::"PDF Handler VTO", OnBeforeProcessDocumentEntry, '', false, false)]
local procedure SkipDraftDocuments(DocListEntry: Record "Document List VTO"; var Skip: Boolean)
begin
// Skip documents with "Draft" in the name
if DocListEntry."Document Name".Contains('Draft') then
Skip := true;
// Skip all incoming documents
if DocListEntry."Source Type" = DocListEntry."Source Type"::"Incoming Document" then
Skip := true;
end;
Adjust the document list after build
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Rule Engine VTO", OnAfterBuildDocumentList, '', false, false)]
local procedure AdjustDocumentListAfterBuild(var DocumentListVTO: Record "Document List VTO"; SourceSystemID: Guid; SourceDocType: Enum "Report Selection Usage")
begin
if SourceDocType <> "Report Selection Usage"::"S.Invoice" then
exit;
if DocumentListVTO.FindSet() then
repeat
// Automatically exclude internal documents
if DocumentListVTO."Document Name".Contains('Internal') then begin
DocumentListVTO.Included := false;
DocumentListVTO."Sequence No." := 10001;
DocumentListVTO.Modify(false);
end;
until DocumentListVTO.Next() = 0;
end;