Skip to content

Commit 81fd703

Browse files
committed
Show a message when no data could be extracted from an e-document
Guards View extracted data so a document with no structured data shows a clear message instead of a runtime error. Fixes AB#638785.
1 parent 7adc1b3 commit 81fd703

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Apps/W1/EDocument/App/src/Processing/EDocImport.Codeunit.al

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,10 @@ codeunit 6140 "E-Doc. Import"
329329
EDocumentDataStorage: Record "E-Doc. Data Storage";
330330
IStructuredFormatReader: Interface IStructuredFormatReader;
331331
begin
332+
if (EDocument."Structured Data Entry No." = 0) or (not EDocumentDataStorage.Get(EDocument."Structured Data Entry No.")) then
333+
Error(NoExtractedDataErr);
334+
332335
IStructuredFormatReader := EDocument."Read into Draft Impl.";
333-
EDocumentDataStorage.Get(EDocument."Structured Data Entry No.");
334336
IStructuredFormatReader.View(EDocument, EDocumentDataStorage.GetTempBlob());
335337
end;
336338

@@ -914,6 +916,7 @@ codeunit 6140 "E-Doc. Import"
914916
DocTypeIsNotSupportedErr: Label 'Document type %1 is not supported.', Comment = '%1 - Document Type';
915917
FailedToFindVendorErr: Label 'No vendor is set for Edocument';
916918
CannotProcessEDocumentMsg: Label 'Cannot process E-Document %1 with Purchase Order %2 before Purchase Order has been matched and posted for E-Document %3.', Comment = '%1 - E-Document entry no, %2 - Purchase Order number, %3 - EDocument entry no.';
919+
NoExtractedDataErr: Label 'There is no extracted data to display for this e-document. Please check if it is a valid invoice or could not be read.';
917920

918921
[IntegrationEvent(false, false)]
919922
local procedure OnAfterProcessIncomingEDocument(EDocument: Record "E-Document"; EDocImportParameters: Record "E-Doc. Import Parameters"; StartState: Enum "Import E-Doc. Proc. Status"; DesiredEndState: Enum "Import E-Doc. Proc. Status")

0 commit comments

Comments
 (0)