[Enforced Digital Vouchers] - Attaching E-Documents when using Digital Vouchers#29793
[Enforced Digital Vouchers] - Attaching E-Documents when using Digital Vouchers#29793GMatuleviciute wants to merge 16 commits into
Conversation
Introduces E-Document as a new check type for digital vouchers, enforcing automatic generation and linking for purchase documents. Updates UI logic to ensure consistent behavior and validation. Extends data structures and event handling to support E-Document attachment and integration with related processes. Enables more robust compliance with regulatory requirements for electronic document management.
Adds feature flag and setup validations before attaching digital vouchers to documents, ensuring attachments only occur when the functionality is enabled and properly configured. Expands handling for purchase credit memos and improves type checks for both sales and purchase documents.
Streamlines digital voucher validation by generalizing E-Document attachment to support more document types and rely on record references rather than hardcoded field access or document types. Improves maintainability and feature extensibility by extracting document details via a dedicated method and refining permission set object ordering. Enhances code clarity and robustness in preparation for feature expansion.
Introduces comprehensive automated tests covering E-Document attachment behavior for sales and purchase documents, ensuring correct enforcement and attachment logic. Updates dependency declarations for better test isolation, removes unused variables, and improves error checking and file name handling for E-Document processing. Enhances reliability and maintainability of digital voucher and E-Document integration.
…herEntrySetup.Table.al Co-authored-by: Grasiele Matuleviciute <131970463+GMatuleviciute@users.noreply.github.com>
…herEntrySetup.Table.al Co-authored-by: Grasiele Matuleviciute <131970463+GMatuleviciute@users.noreply.github.com>
Refactors E-Document file attachment for purchase documents by relocating the logic from the check codeunit to the main implementation codeunit, improving code structure and responsibility separation. Updates test object ranges, enhances test reliability, and adjusts error handling to use labels for better localization. Clarifies and simplifies validation around E-Document requirements and streamlines page variable initialization. Improves maintainability and prepares for future extensibility.
…implements "Digital Voucher Check"
|
Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link. |
Improves observability by logging errors via feature telemetry when e-document attachment operations fail, including XML extraction from PDFs and incoming document imports. This helps diagnose issues in production without relying solely on user-reported errors. Refactors a purchase document test helper to separate the case where no e-document link is needed, removing an unnecessary guard condition and simplifying the overload that requires an e-document record. Also includes minor code style normalizations (variable reordering, lowercase `error()` calls) for consistency.
AndriusAndrulevicius
left a comment
There was a problem hiding this comment.
Comments resolved
Replaces dynamic error text and call stack capture in telemetry logging with static, descriptive messages to avoid exposing potentially sensitive runtime details in telemetry. Reorders permission set entries to group tables, pages, and codeunits together for better readability and consistency. Also adds missing newlines at end of JSON and table files to follow standard file formatting conventions.
AndriusAndrulevicius
left a comment
There was a problem hiding this comment.
Comments resolved
…tal Vouchers (#7006) This pull request does not have a related issue as it's part of the delivery for development agreed directly with @altotovi @Groenbech96 **Implementation** These integration events are required for the Enforced Digital Vouchers app to subscribe to E-Document processing and attach digital voucher records at the correct points in the document lifecycle. **Events added** OnExportEDocumentAfterCreateEDocument in EDocExport.Codeunit.al — Raised after the e-document content has been generated and the success status determined, but before the service status is logged. This placement allows the Digital Vouchers subscriber to access the finalized document blob (TempBlob) and the mapped source document records, which are needed to create and associate a digital voucher with the exported e-document. OnAfterUpdateToPostedPurchaseEDocument in EDocumentSubscribers.Codeunit.al — Raised after a received purchase e-document is updated to its posted state (document record ID, document number, type, and status are all set). This placement allows the Digital Vouchers subscriber to link the digital voucher to the final posted purchase document, since the posted document number and record ID are only available at this point. > [!IMPORTANT] > This Pull request related with microsoft/ALAppExtensions#29793 Fixes [AB#580350](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/580350) --------- Co-authored-by: Andrius Andrulevicius <andrius.andrulevicius@companial.com>
|
Creating an ADO PR. |
|
Processing this PR. The branch is now locked 🔒 Please don't push updates unless otherwise agreed. |
|
Compilation fails with: |
@JesperSchulz Created related PR in BCApps repos, to fix compilation issue microsoft/BCApps#8677 |
This pull request does not have a related issue as it's part of the delivery for development agreed directly with @altotovi @Groenbech96
Implementation
With this update enhanced automation for Digital Vouchers in sales and purchase document posting. When enabled, the system will automatically generate and attach E-Documents and related files to posted documents, streamlining document management and compliance.
Functional Changes
When posting sales or purchase documents, if setup is set to use E-Documents the system will attach related E-Document files to the Incoming Document Files of the posted sales/purchase document.
Impact
Reduces manual effort in attaching compliance documents.
Ensures all relevant files are consistently linked to posted documents.
Important
This Pull request related with microsoft/BCApps#7006
Fixes #
Fixes AB#639562