Skip to content

[Bug]: [E-Document] Receive Single Document procedure #7325

@fmoric

Description

@fmoric

Describe the issue

I have been looking at ReceiveSingleDocument implementation, and as i can see that all of standard implementations (Pagero, Avalara etc...) use something like:
EDocumentErrorHelper.LogSimpleErrorMessage

to log error, and attach it to that E-Document, and that is ok, I mean, like, you want to try to download document, but something happens and you want to log error. The problem is that if you log error, when downloader exits, it measures success by counts of errors:

        ReceiveContext.Status().SetStatus("E-Document Service Status"::Imported);
        ErrorCount := EDocumentErrorHelper.ErrorMessageCount(EDocument);
        RunDownloadDocument(EDocument, EDocumentService, DocumentMetadata, IDocumentReceiver, ReceiveContext);
        Success := EDocumentErrorHelper.ErrorMessageCount(EDocument) = ErrorCount;

And if it is not success, the document is deleted:

 if ReceiveSingleDocument(EDocument, EDocumentService, DocumentMetadata, IDocumentReceiver) then begin
                // Insert shared data for all imported documents        
                EDocumentLog.SetBlob(EDocument."File Name", "E-Doc. File Format"::Unspecified, DocumentMetadata);
                EDocumentLog.InsertLog(Enum::"E-Document Service Status"::"Batch Imported");
                EDocumentLog.InsertIntegrationLog(EDocument, EDocumentService, ReceiveContext.Http().GetHttpRequestMessage(), ReceiveContext.Http().GetHttpResponseMessage());
            end else
                EDocument.Delete();

Am i missing something here?

Expected behavior

For E-Document to remain so that logged error, that is attached to it to be seen.

Steps to reproduce

Try to receive documents, and download it with error, or as i see LogSimpleErrorMessage.

Additional context

No response

I will provide a fix for a bug

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    IntegrationGitHub request for Integration area

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions