Skip to content

Fix silent failure when deleting from E-Documents and Outbound E-Documents pages#8267

Open
Groenbech96 wants to merge 1 commit into
mainfrom
private/magnushar/bug-620048-edoc-delete
Open

Fix silent failure when deleting from E-Documents and Outbound E-Documents pages#8267
Groenbech96 wants to merge 1 commit into
mainfrom
private/magnushar/bug-620048-edoc-delete

Conversation

@Groenbech96
Copy link
Copy Markdown
Contributor

@Groenbech96 Groenbech96 commented May 21, 2026

Summary

  • DeleteAllowed = false on page 6106 (Outbound E-Documents) and page 6122 (E-Documents) caused delete attempts to silently do nothing — no error, no feedback to the user
  • Changing to DeleteAllowed = true routes deletion through the table's OnDelete trigger (table 6103), which already enforces the correct rules:
    • Blocks deletion of Processed documents with a clear error message
    • Blocks deletion of linked documents (Document Record ID set) with a clear error message
    • For unlinked, non-processed documents (e.g. EDI purchase orders), allows deletion with a confirmation prompt
  • Aligns both pages with InboundEDocuments (page 6162) which already uses DeleteAllowed = true

Test plan

  • Attempt to delete a Processed outbound e-document → error message shown
  • Attempt to delete an outbound e-document linked to a BC document → error message shown
  • Attempt to delete an unlinked, non-processed e-document (e.g. EDI PO) → confirmation prompt, then deleted
  • Same three cases on E-Documents page (6122)

AB#620048

…ments pages

DeleteAllowed = false caused delete attempts to silently do nothing — no error,
no feedback. Changing to true routes deletion through the table's OnDelete trigger,
which already enforces the correct rules: blocks Processed and linked documents with
clear error messages, allows deletion (with confirmation) for unlinked documents
such as EDI purchase orders.

Aligns both pages with InboundEDocuments (page 6162) which already uses DeleteAllowed = true.

Fixes AB#620048

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Groenbech96 Groenbech96 requested a review from a team as a code owner May 21, 2026 09:17
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label May 21, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone May 21, 2026
AdditionalSearchTerms = 'Edoc,Electronic Document,EDocuments,E Documents,E invoices,Einvoices,Electronic';
RefreshOnActivate = true;
Editable = false;
DeleteAllowed = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟠\ High\ Severity\ —\ Security} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

List page now allows deleting e-documents

The general E-Documents list page (covering both inbound and outbound) now permits deletion. The table-level OnDelete guard blocks Status=Processed records and linked records, but documents with service-level status 'Sent', 'Approved', or 'Pending Response' whose main status is still 'In Progress' can be deleted, potentially destroying audit trail evidence required by e-invoicing regulations (e.g., Peppol, EU VAT Directive) in many jurisdictions.

Recommendation:

  • If deletion is intentional for error-state or duplicate documents only, restrict it via an OnDeleteRecord page trigger that enforces the same service-status checks as recommended for the Outbound page, rather than relying solely on the table trigger.
Suggested change
DeleteAllowed = false;
// Add an OnDeleteRecord trigger to enforce service-status checks:
trigger OnDeleteRecord(): Boolean
var
EDocumentServiceStatus: Record "E-Document Service Status";
begin
EDocumentServiceStatus := Rec.GetEDocumentServiceStatus();
if EDocumentServiceStatus.Status in [
EDocumentServiceStatus.Status::Sent,
EDocumentServiceStatus.Status::Approved,
EDocumentServiceStatus.Status:"Pending Response"]
then
Error(CannotDeleteTransmittedDocErr);
end;

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

PageType = List;
RefreshOnActivate = true;
Editable = false;
DeleteAllowed = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟠\ High\ Severity\ —\ Security} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Deletion enabled for sent outbound e-documents

Changing DeleteAllowed to true on the Outbound E-Documents page allows users to delete records of documents that may already have been transmitted to customers or tax authorities (e.g., service status 'Sent', 'Approved', 'Pending Response'). The table-level OnDelete guard only blocks records where main Status = Processed; a document can be 'Sent' at the service level while still having main status 'In Progress', leaving a gap that permits deletion of legally relevant outbound invoices.

Recommendation:

  • Either keep DeleteAllowed = false on the Outbound E-Documents page, or add an OnDeleteRecord trigger that also checks service-level status (Sent, Approved, Pending Response, Cleared) and raises an error before the table delete fires.
Suggested change
DeleteAllowed = false;
trigger OnDeleteRecord(): Boolean
var
EDocumentServiceStatus: Record "E-Document Service Status";
begin
EDocumentServiceStatus := Rec.GetEDocumentServiceStatus();
if EDocumentServiceStatus.Status in [
EDocumentServiceStatus.Status::Sent,
EDocumentServiceStatus.Status::Approved,
EDocumentServiceStatus.Status:"Pending Response",
EDocumentServiceStatus.Status::Cleared]
then
Error(CannotDeleteTransmittedDocErr);
end;

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant