Fix silent failure when deleting from E-Documents and Outbound E-Documents pages#8267
Fix silent failure when deleting from E-Documents and Outbound E-Documents pages#8267Groenbech96 wants to merge 1 commit into
Conversation
…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>
| AdditionalSearchTerms = 'Edoc,Electronic Document,EDocuments,E Documents,E invoices,Einvoices,Electronic'; | ||
| RefreshOnActivate = true; | ||
| Editable = false; | ||
| DeleteAllowed = false; |
There was a problem hiding this comment.
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
OnDeleteRecordpage trigger that enforces the same service-status checks as recommended for the Outbound page, rather than relying solely on the table trigger.
| 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; |
There was a problem hiding this comment.
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 = falseon the Outbound E-Documents page, or add anOnDeleteRecordtrigger that also checks service-level status (Sent, Approved, Pending Response, Cleared) and raises an error before the table delete fires.
| 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
Summary
DeleteAllowed = falseon page 6106 (Outbound E-Documents) and page 6122 (E-Documents) caused delete attempts to silently do nothing — no error, no feedback to the userDeleteAllowed = trueroutes deletion through the table'sOnDeletetrigger (table 6103), which already enforces the correct rules:InboundEDocuments(page 6162) which already usesDeleteAllowed = trueTest plan
AB#620048