From 82553cbc80096dca0d9403e2c0d1be2c0f4fa02c Mon Sep 17 00:00:00 2001 From: Andrius Andrulevicius Date: Tue, 24 Feb 2026 11:23:11 +0200 Subject: [PATCH 1/4] Adds integration events for E-Document export and update Introduces new integration events to enable external handlers after creating an exported e-document and after updating a posted purchase e-document. Enhances extensibility for partners and custom solutions by allowing additional logic to be executed at these key points. --- .../EDocument/App/src/Processing/EDocExport.Codeunit.al | 6 ++++++ .../App/src/Processing/EDocumentSubscribers.Codeunit.al | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al b/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al index 4a94fe2123..36ce15e0fc 100644 --- a/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al @@ -167,6 +167,7 @@ codeunit 6102 "E-Doc. Export" ErrorCount := EDocumentErrorHelper.ErrorMessageCount(EDocument); CreateEDocument(EDocumentService, EDocument, SourceDocumentHeaderMapped, SourceDocumentLineMapped, TempBlob); Success := EDocumentErrorHelper.ErrorMessageCount(EDocument) = ErrorCount; + OnExportEDocumentAfterCreateEDocument(EDocumentService, EDocument, SourceDocumentHeaderMapped, SourceDocumentLineMapped, TempBlob, Success); if Success then EDocServiceStatus := Enum::"E-Document Service Status"::Exported else @@ -530,4 +531,9 @@ codeunit 6102 "E-Doc. Export" local procedure OnAfterCreateEDocument(var EDocument: Record "E-Document"; var SourceDocumentHeader: RecordRef) begin end; + + [IntegrationEvent(false, false)] + local procedure OnExportEDocumentAfterCreateEDocument(EDocumentService: Record "E-Document Service"; EDocument: Record "E-Document"; SourceDocumentHeaderMapped: RecordRef; SourceDocumentLineMapped: RecordRef; var TempBlob: Codeunit "Temp Blob"; Success: Boolean) + begin + end; } diff --git a/src/Apps/W1/EDocument/App/src/Processing/EDocumentSubscribers.Codeunit.al b/src/Apps/W1/EDocument/App/src/Processing/EDocumentSubscribers.Codeunit.al index a11862a36e..868ba598b2 100644 --- a/src/Apps/W1/EDocument/App/src/Processing/EDocumentSubscribers.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Processing/EDocumentSubscribers.Codeunit.al @@ -573,7 +573,9 @@ codeunit 6103 "E-Document Subscribers" EDocument."Document Type" := DocumentType; EDocument.Status := Enum::"E-Document Status"::Processed; EDocument.Modify(true); - + + OnAfterUpdateToPostedPurchaseEDocument(EDocument, PostedRecord, PostedDocumentNo, DocumentType); + EDocService := EDocumentLog.GetLastServiceFromLog(EDocument); EDocLogHelper.InsertLog(EDocument, EDocService, Enum::"E-Document Service Status"::"Imported Document Created"); end; @@ -632,4 +634,8 @@ codeunit 6103 "E-Document Subscribers" Telemetry.LogMessage('0000PYF', DraftChangeTok, Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::All, TelemetryDimensions); end; + [IntegrationEvent(false, false)] + local procedure OnAfterUpdateToPostedPurchaseEDocument(var EDocument: Record "E-Document"; PostedRecord: Variant; PostedDocumentNo: Code[20]; DocumentType: Enum "E-Document Type") + begin + end; } From 279035e8dbfdf90d95fdef79aedf36b5a953a501 Mon Sep 17 00:00:00 2001 From: Andrius Andrulevicius Date: Fri, 27 Feb 2026 10:32:49 +0200 Subject: [PATCH 2/4] Add Enforced Digital Vouchers as a dependency in app.json --- src/Apps/W1/EDocument/App/app.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Apps/W1/EDocument/App/app.json b/src/Apps/W1/EDocument/App/app.json index be4f057996..a60db7a71c 100644 --- a/src/Apps/W1/EDocument/App/app.json +++ b/src/Apps/W1/EDocument/App/app.json @@ -37,6 +37,11 @@ "id": "967eceac-106e-4102-b76a-fe5dc3d799e5", "name": "Payables Agent Tests", "publisher": "Microsoft" + }, + { + "id": "e2ae191d-8829-44c3-a373-3749a2742d4e", + "name": "Enforced Digital Vouchers", + "publisher": "Microsoft" } ], "screenshots": [], From 7acb31384568a5643ada0d8d884ec9ce9fb9d1e0 Mon Sep 17 00:00:00 2001 From: Grasiele Matuleviciute Date: Wed, 4 Mar 2026 13:57:04 +0200 Subject: [PATCH 3/4] Removed Enforced Digital Vouchers dependancy --- src/Apps/W1/EDocument/App/app.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Apps/W1/EDocument/App/app.json b/src/Apps/W1/EDocument/App/app.json index a60db7a71c..be4f057996 100644 --- a/src/Apps/W1/EDocument/App/app.json +++ b/src/Apps/W1/EDocument/App/app.json @@ -37,11 +37,6 @@ "id": "967eceac-106e-4102-b76a-fe5dc3d799e5", "name": "Payables Agent Tests", "publisher": "Microsoft" - }, - { - "id": "e2ae191d-8829-44c3-a373-3749a2742d4e", - "name": "Enforced Digital Vouchers", - "publisher": "Microsoft" } ], "screenshots": [], From d1284667e7758a4df6f2dba4d4573ef5b7e64619 Mon Sep 17 00:00:00 2001 From: Andrius Andrulevicius Date: Thu, 12 Mar 2026 11:37:51 +0200 Subject: [PATCH 4/4] Moves event trigger after document status update Adjusts the timing of the post-creation event to ensure it is called after the document and service statuses have been updated. This change helps external handlers to access the latest status information, improving reliability for event subscribers. --- src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al b/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al index 36ce15e0fc..f1230cc8bc 100644 --- a/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al +++ b/src/Apps/W1/EDocument/App/src/Processing/EDocExport.Codeunit.al @@ -167,7 +167,6 @@ codeunit 6102 "E-Doc. Export" ErrorCount := EDocumentErrorHelper.ErrorMessageCount(EDocument); CreateEDocument(EDocumentService, EDocument, SourceDocumentHeaderMapped, SourceDocumentLineMapped, TempBlob); Success := EDocumentErrorHelper.ErrorMessageCount(EDocument) = ErrorCount; - OnExportEDocumentAfterCreateEDocument(EDocumentService, EDocument, SourceDocumentHeaderMapped, SourceDocumentLineMapped, TempBlob, Success); if Success then EDocServiceStatus := Enum::"E-Document Service Status"::Exported else @@ -184,6 +183,7 @@ codeunit 6102 "E-Doc. Export" else EDocumentProcessing.ModifyServiceStatus(EDocument, EDocumentService, EDocServiceStatus); EDocumentProcessing.ModifyEDocumentStatus(EDocument); + OnExportEDocumentAfterCreateEDocument(EDocumentService, EDocument, SourceDocumentHeaderMapped, SourceDocumentLineMapped, TempBlob, Success); end; internal procedure ExportEDocumentBatch(var EDocuments: Record "E-Document"; var EDocService: Record "E-Document Service"; var TempEDocMappingLogs: Record "E-Doc. Mapping Log" temporary; var TempBlob: Codeunit "Temp Blob"; var EDocumentsErrorCount: Dictionary of [Integer, Integer])